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>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <classifier>for-unit-tests</classifier>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>jar</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>
      <artifactId>theArtifact</artifactId>
      <version>${project.version}</version>
      <classifier>for-unit-tests</classifier>
      <type>jar</type>
      <scope>compile</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>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
          <verbose>true</verbose>
          <compilerArguments>
                <classpath>war_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]

Reply via email to