Showing posts with label copy. Show all posts
Showing posts with label copy. Show all posts

Tuesday, December 4, 2012

Maven Is Back, Stronger Than Ever

Guess what this does, in proper maven resource plugin context:

<configuration>
<outputDirectory>target/classes</outputDirectory>
<excludes>
<exclude>**/*.java</exclude>
<exclude>**/*.class</exclude>
<exclude>**/.svn</exclude>
</excludes>
<resources>
<resource>
<directory>src/test/java</directory>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/java</directory>
<filtering>false</filtering>
</resource>
</resources>
</configuration>

Copies resources out of src/test/java and src/main/java, excluding files matching the specified patterns? 

Wrong. Or, mostly wrong. 

The exclusions will apply to the src/test/java directory paths, but not the src/main/java. Yep, at least in the version we use. 

Caveat utilitor.


Monday, December 3, 2012

Maven Copy Plugin

This (new?) Maven 'copy' plugin: http://evgeny-goldin.com/wiki/Copy-maven-plugin, seems to be a useful tool to simplify some Maven projects. It seems to be a good way to using a minimal number of plugins for common tasks. This is not a deep review; I'm just blogging this as sort of a mental note.

But it could be used for the following problem: I recently learned a second way that the 'real' Maven and running under the Eclipse Maven plugin differs, in that resource files in /src/man/java are copied; but not so with Maven defaults. (The other difference I know of is that Eclipse has only one classpath, the same for both src/test and src/main. Fertile ground for bad imports.) It's easy to add with a standard plugin, but if you have many such small tasks, then possibly this 'copy' plugin will be better than a bunch of disparate plugins. Maven is verbose enough, I think.