Hey,

In my project I have a dependency that I only want to have on my
compiler-plugin classpath, but not on my normal project classpath.

This is my code:
<build>
 ...
 <plugins>
   ...
   <plugin>
     <groupId>org.apache.maven.plugins</groupId>
     <artifactId>maven-compiler-plugin</artifactId>
     <configuration>
       <verbose>true</verbose>
       <compilerArguments>
         <s>${basedir}/target/generated-sources</s>
       </compilerArguments>
     </configuration>
     <dependencies>
       <dependency>
         <groupId>my.dependency.groupId</groupId>
         <artifactId>artifactId</artifactId>
         <version>${parent.version}</version>
         <scope>compile</scope>
       </dependency>
     </dependencies>
   </plugin>
   ...
 </plugins>
 ...
</build>

When I run Maven with -X, I see the following output by the compiler plugin:
[INFO] [compiler:compile]
[DEBUG] Using compiler 'javac'.
[DEBUG] Source directories:
[C:\java\work\idea-9\...\buildergenerator\test\src\main\java]
[DEBUG] Classpath: [C:\java\work\idea-9\...\buildergenerator\test\target\classes
 
C:\java\maven-repo\nl\...\buildergenerator\buildergenerator-annotations\0.1-SNAPSHOT\buildergenerator-annotations-0.1-SNAPSHOT.jar
 C:\java\maven-repo\joda-time\joda-time\1.6\joda-time-1.6.jar]

When I add the same dependency as a project dependency, I see the
following output:
[INFO] [compiler:compile]
[DEBUG] Using compiler 'javac'.
[DEBUG] Source directories:
[C:\java\work\idea-9\...\buildergenerator\test\src\main\java]
[DEBUG] Classpath: [C:\java\work\idea-9\...\buildergenerator\test\target\classes
 
C:\java\maven-repo\nl\...\buildergenerator\buildergenerator-annotations\0.1-SNAPSHOT\buildergenerator-annotations-0.1-SNAPSHOT.jar
 
C:\java\maven-repo\nl\...\buildergenerator\buildergenerator-core\0.1-SNAPSHOT\buildergenerator-core-0.1-SNAPSHOT.jar
 C:\java\maven-repo\org\freemarker\freemarker\2.3.15\freemarker-2.3.15.jar
 C:\java\maven-repo\joda-time\joda-time\1.6\joda-time-1.6.jar]

As you can see, I have one more dependency on my compiler classpath
(buildergenerator-core-0.1-SNAPSHOT.jar).

For some reason, the plugin dependency is not added to the compiler classpath.

Is there a way to fix this? I've also tried to add a <classpath>
element to <compilerArguments>, but this had the effect of removing
all other dependencies from the classpath, which is of course also not
desirable.

Thanks ans regards,
Jan-Kees

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to