Problem compiling project with WAR dependency
Hi All, I've got a couple of projects, 1 is a WAR project, another is a JAR project which needs to depend on the java classes in the WAR. Normally, you wouldn't do this, but in this case, the JAR project is for unit tests and wants to be able to instantiate the Actions in the WAR project. In order to get the WAR project to install both a WAR and JAR artifact to the repository, I've added this plugin to the WAR project: plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-jar-plugin/artifactId configuration classifierfor-unit-tests/classifier /configuration executions execution goals goaljar/goal /goals /execution /executions /plugin Then, in order to depend on that code, I have the following dependency in the Unit Test project: dependency groupId${project.groupId}/groupId artifactIdtheArtifact/artifactId version${project.version}/version classifierfor-unit-tests/classifier typejar/type scopecompile/scope /dependency If I go ahead and compile/install this from this project, it works fine. However, if I invoke the compilation at a higher level - for instance if I go to the root project that is the parent of both of these, and run 'mvn clean install', the compile step fails because the WAR's target/classes directory is not on the classpath. I have no idea why this is the case. I've tried to tweak the compiler to include it manually like so: plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-compiler-plugin/artifactId configuration source1.5/source target1.5/target verbosetrue/verbose compilerArguments classpathwar_project/target/classes/classpath /compilerArguments /configuration /plugin but then it blows away the rest of the compile classpath. And I haven't found a way to manually append to the existing classpath. Can anyone help me out? Thanks. -- View this message in context: http://www.nabble.com/Problem-compiling-project-with-WAR-dependency-tf4524072s177.html#a12907017 Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem compiling project with WAR dependency
cdesaint [EMAIL PROTECTED] writes: Hi All, I've got a couple of projects, 1 is a WAR project, another is a JAR project which needs to depend on the java classes in the WAR. Normally, you wouldn't do this, but in this case, the JAR project is for unit tests and wants to be able to instantiate the Actions in the WAR project. Couldn't you just split your war ? If you need to have a separate artifact for unit testing, then go ahead, the code is telling you it wants to be split. Modules are cheap in maven. HTH -- OQube software engineering \ génie logiciel Arnaud Bailly, Dr. \web http://www.oqube.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Problem compiling project with WAR dependency
Yes, that is definitely an option that I may need to pursue. It's unfortunate, though, since the way I have it set up *should* work. This just seems like a bug in the dependency plugin which it depends on source modules as opposed to the artifacts built in the repos... Arnaud Bailly wrote: cdesaint [EMAIL PROTECTED] writes: Hi All, I've got a couple of projects, 1 is a WAR project, another is a JAR project which needs to depend on the java classes in the WAR. Normally, you wouldn't do this, but in this case, the JAR project is for unit tests and wants to be able to instantiate the Actions in the WAR project. Couldn't you just split your war ? If you need to have a separate artifact for unit testing, then go ahead, the code is telling you it wants to be split. Modules are cheap in maven. HTH -- OQube software engineering \ génie logiciel Arnaud Bailly, Dr. \web http://www.oqube.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Problem-compiling-project-with-WAR-dependency-tf4524072s177.html#a12909417 Sent from the Maven - Users mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]