war dependency not being picked up?
hi all, I've searched, but can't see a suitable answer. apols if I've missed one. I have a project which has two modules which compile with war packaging, and I need to perform integration testing using both these wars. the project contains a web service and WS client on both sides, I need to functionally test this, deploying the wars using the Cargo plugin. so I have created a functional-testing module, which contains the tests, but the tests have dependencies on classes in the other modules. I have listed the modules as dependencies of the funtional test pom, but the compile phase fails, as it can't see these classes. if I rig the build to compile the modules as jars instead, the compilation succeeds (but obviously the tests can't run, as I need wars to be deployed). I've checked that the first module is compiling to a war, with the right names and version numbers, etc, and that the classes needed are contained in WEB-INF/classes. I've seen the maven-dependency-plugin mentioned as a solution to this, not how to do this. what goal would do what I need? Would it be better to leave the test classes in the modules that compile to wars, exclude them from that module's surfire configuration, and have the functional test module contain no code itself, but just call these test classes? and would this work, or would they also not be able to see the test classes? any help would be much appreciated. snippet of the start of one of the modules which compiles to a war: project xmlns=http://maven.apache.org/POM/4.0.0; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd; modelVersion4.0.0/modelVersion groupIdorg.blah.blah/groupId artifactIdblahWar/artifactId version1.0.1-Continuous/version packagingwar/packaging and the functional test pom: modelVersion4.0.0/modelVersion artifactIdfunctional-tests/artifactId packagingpom/packaging namefunctional tests/name ... dependencies ... dependency groupIdorg.blah.blah/groupId artifactIdblahWar/artifactId version1.0.1-Continuous/version typewar/type /dependency /dependencies -- View this message in context: http://www.nabble.com/war-dependency-not-being-picked-up--tp21414576p21414576.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: war dependency not being picked up?
On Mon, Jan 12, 2009 at 6:37 AM, Ben Avery b...@youthnet.org wrote: so I have created a functional-testing module, which contains the tests, but the tests have dependencies on classes in the other modules. I have listed the [war] modules as dependencies of the funtional test pom, but the compile phase fails, as it can't see these classes. if I rig the build to compile the modules as jars instead, the compilation succeeds (but obviously the tests can't run, as I need wars to be deployed). This is expected. Java has no concept of a war file on the classpath. (It expects the directory structure to start at the root of the file, it doesn't know to look down under WEB-INF/classes.) A couple of options - move the classes out to a separate module and build a jar from that, which would then be a normal dependency for both the war and the tests, or - configure the war plugin to 'attach' the classes as a jar artifact in addition to the war, so you can depend on the jar from other projects. -- Wendy - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org
Re: war dependency not being picked up?
thank you Wendy, that's wonderful :) for anyone else wanting to do this, here's what I did: I went for the second option. details on both are on the maven-war-plugin's FAQ. it's the second part here: http://maven.apache.org/plugins/maven-war-plugin/faq.html#attached this only works in the development version of the war plugin (until 2.1 is released), so add the following to your pluginRepositories tag: pluginRepository idsnapshots/id urlhttp://people.apache.org/repo/m2-snapshot-repository//url /pluginRepository then you can use version 2.1-beta-1-SNAPSHOT of the war plugin. now when you run the maven build, you get a jar and a war installed to your repository. but as the jar file has -classes appended to the filename, you need to tell maven this by adding: classifierclasses/classifier to the dependency tag you need. thanks again B Wendy Smoak-3 wrote: On Mon, Jan 12, 2009 at 6:37 AM, Ben Avery b...@youthnet.org wrote: so I have created a functional-testing module, which contains the tests, but the tests have dependencies on classes in the other modules. I have listed the [war] modules as dependencies of the funtional test pom, but the compile phase fails, as it can't see these classes. if I rig the build to compile the modules as jars instead, the compilation succeeds (but obviously the tests can't run, as I need wars to be deployed). This is expected. Java has no concept of a war file on the classpath. (It expects the directory structure to start at the root of the file, it doesn't know to look down under WEB-INF/classes.) A couple of options - move the classes out to a separate module and build a jar from that, which would then be a normal dependency for both the war and the tests, or - configure the war plugin to 'attach' the classes as a jar artifact in addition to the war, so you can depend on the jar from other projects. -- Wendy - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org -- View this message in context: http://www.nabble.com/war-dependency-not-being-picked-up--tp21414576p21419364.html Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org