Maven defaults is missing something
- Java files in
src/main/java
- All resources in
src/main/resources
But for some resources it makes sence to keep them "close" to the java class using it - say in the same package. I could do that by duplicating package structure in my resources directory, but that would be repeating myself and breaking the good old DRY principle. But furthermore and much more important I risk to miss the resource files when refactoring my build (renaming packages, moving classes).
So I always end up overwriting the resources definition in my pom.xml to something like this:
<build>I have been one of the defenders of mavens conventions, but this time it seems to be missing something.
<resources>
<resource>
<directory>${basedir}/src/main/resources</directory>
</resource>
<resource>
<directory>${basedir}/src/main/java</directory>
</resource>
</resources>
</build>
Can anyone tell me why this isn't the default in maven?
I can't be the only one placing resources along side with my java files.
3 comments:
The main reason to separate resources from other sources is that this way it is much faster to copy or filter them out.
I agree that speed in build turnaround time is essential - but is it really that time consuming?
I must say I haven't been blaming copy and filtering as the root cause of the slow builds I have been puzzling with.
I see where Eugene is coming from and I see where you are coming from Jacob. I often wish that someone just forked Maven and created a distribution with another set of assumptions, then we'd just see who's assumptions won out in the free market.
Post a Comment