|
So is it really a war plugin issue ? IMHO it's not a war-plugin bug, but a m2eclipse bug. I've experienced it using m2eclipse, but not using command-line mvn. Guys, you can call this an m2eclipse bug or feature, but it all boils down to the current Maven and maven-war-plugin limitations. What happen is that m2eclipse can resolve projects from the Eclipse workspace, so you can compile and run your code without deploying dependent projects to the Maven local repository. Normally, when Maven resolves artifacts it points to the file from the Maven local repository, but in order to make workspace dependency resolution work, m2eclipse replaces that link to a link pointing to a /target/classes folder for the corresponding project (you can see that in the exception stack trace above). All in all, there is no easy fix for this issue on m2eclipse side, however the maven-war-plugin could detect that it got a class folder and not the jar file for the given artifact and in that case it can simply jar that folder and include the result jar into the web-inf/lib instead of trying to blindly copy it there. Please also note that you can disable workspace resolution when launching Maven builds from m2eclipse, so Maven would resolve artifacts from the local repository. A quick and dirty patch that fixes the issue in m2eclipse. Basically it just jars the classes folder substituted by m2eclipse instead of jar from the local Maven repo. Yes this is a problem that make using m2eclipse to build multimodule projects in eclipse very painful indeed. Please do fix this, its not a feature, its a bug... m2eclipse should do the following: 1.) look at the project and make sure its build status is up to date 2.) look for produced artifact jar in target directory 3.) if not, look for classes directory and mount that. 4.) otherwise, attempt to run mvn package within the project and create the artifacts. Mark, I am not sure you understand the issue. The m2eclipse don't have much control on the build, so it isn't really option for it to go somewhere and do something when Maven build is requesting some arbitrary artifact. The present Maven API does not provide any context what requested artifact is needed for, so while workspace resolution is working fine for compile-time needs, other plugins, including the maven-war-plugin fail when they get reference to an exploded classpath folder instead of a jar. What I don't understand about this (and which I already wasted substantial time over) is why not even the following works: <plugin> Even though I'm explicitly disallowing our project's groupIds to be copied over and declaring that I'm only interested in Spring, it insists on accessing the classes folder on a dependency I'm uninterested in. I'm also clearly stating that I'm uninterested in transitive dependencies. So, does this mean that there is no way to copy any dependency to an external folder with the "resolve workspace" checkbox enabled? What this means is that we have 2 choices here (due to our modular architecture):
Not copying dependencies over to the WEB-INF/lib folder is not an option (mainly due to a bug in the bootstrap classloader, but also because that's where they belong). Andras, please see my explanation in comment from 07/May/09. Your third and fully supported option is to use the WTP integration while developing in the IDE (i.e. have WTP integration enabled and let WTP to package and copy required jars into WEB-INF/lib), in that case you won't need any additional configuration like maven-dependency-plugin, which also known as not compatible with m2e's workspace dependency resolution mode. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
note, using m2eclipse (probably handy info)