Allright, I should have provided a bit more context. Here it is:
I've written an APT annotation processor which generates builder
classes for immutable objects. Objects annotated with @Immutable are
processed by this annotation processor and code is generated
appropriately.
It used to contain only one module, containing both the annotations,
the processor class and a META-INF file to configure the processor...
The annoying thing of this was that the compiler auto-detects any
processors on the classpath and invokes them automatically. This is
something I don't want, so I decided to split it up into two parts:
- First a project with the annotations (the project that uses the
builder, needs to have the annotations on its classpath, since they
are in the source code).
- The other project contains the processor and its configuration. This
is not a compile dependency and I don't want it in my distribution.
It's a tool and I only want it on the classpath when compiling.
The reason not to use a project dependency with scope=provided is
because of my IDE's. On my project, we use both IntelliJ and RSA and I
don't want the processor project on the classpath, since it modifies
the build/make process in the IDE. This causes issues with build/make,
because the processor gets invoked by it, leading to duplicate class
kind of compiler errors, because it's trying to generate a class
that's already generated by the maven-compiler-plugin.
So, long story short (and also after cleaning up my own mind), it
looks like I need a provided dependency, but I don't want it to be
included in my eclipse/idea classpath. I hoped to achieve this by
using a plugin dependency, but maybe I can just as easy exclude it
from those plugins (eclipse:idea)...
Regards,
Jan-Kees
2010/1/20 Stephen Connolly stephen.alan.conno...@gmail.com:
scope=provided
2010/1/20 Jan-Kees van Andel jankeesvanan...@apache.org:
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
groupIdorg.apache.maven.plugins/groupId
artifactIdmaven-compiler-plugin/artifactId
configuration
verbosetrue/verbose
compilerArguments
s${basedir}/target/generated-sources/s
/compilerArguments
/configuration
dependencies
dependency
groupIdmy.dependency.groupId/groupId
artifactIdartifactId/artifactId
version${parent.version}/version
scopecompile/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
-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org
-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org