Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How do I determine the stale resources in a Mojo to avoid reprocessing them?

0
Posted

How do I determine the stale resources in a Mojo to avoid reprocessing them?

0

This can be done using the following piece of code: // Imports needed import org.codehaus.plexus.compiler.util.scan.InclusionScanException; import org.codehaus.plexus.compiler.util.scan.StaleSourceScanner; import org.codehaus.plexus.compiler.util.scan.mapping.SuffixMapping; // At some point of your code StaleSourceScanner scanner = new StaleSourceScanner( 0, Collections.singleton( “**/*.xml” ), Collections.EMPTY_SET ); scanner.addSourceMapping( new SuffixMapping( “.xml”, “.html” ) ); Set staleFiles = (Set) scanner.getIncludedSources( this.sourceDirectory, this.targetDirectory ); The second parameter to the StaleSourceScanner is the set of includes, while the third parameter is the set of excludes. You must add a source mapping to the scanner (second line). In this case we’re telling the scanner what is the extension of the result file (.html) for each source file extension (.xml).

0

This can be done using the following piece of code: // Imports needed import org.codehaus.plexus.compiler.util.scan.InclusionScanException; import org.codehaus.plexus.compiler.util.scan.StaleSourceScanner; import org.codehaus.plexus.compiler.util.scan.mapping.SuffixMapping; // At some point of your code StaleSourceScanner scanner = new StaleSourceScanner( 0, Collections.singleton( “**/*.xml” ), Collections.EMPTY_SET ); scanner.addSourceMapping( new SuffixMapping( “.xml”, “.html” ) ); Set staleFiles = (Set) scanner.getIncludedSources( this.sourceDirectory, this.targetDirectory ); The second parameter to the StaleSourceScanner is the set of includes, while the third parameter is the set of excludes. You must add a source mapping to the scanner (second line). In this case we’re telling the scanner what is the extension of the result file (.html) for each source file extension (.xml). Finally we get the stale files as a Set calling the getIncludedSources method, passing a

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.