You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by David Goodenough <da...@btconnect.com> on 2009/04/06 11:47:52 UTC
maven-compiler-plugin resources not in classpath
I am trying to use maven to compile a java annotation processor.
When you build a jar which contains an annotation processor you can put
a file (META-INF/services/javax.annotation.processing.Processor) which
contains one line per annotation processor. With this file in place you
then only have to include the jar in the javac classpath to get it to
process annotations, you do not have to mention it on the command line.
Unforunately if you build your pom.xml to include this file under the
resources tag, it gets included in the classpath, and then the compiler
complains that the annotation processor it is compiling (the one mentioned
in the file) does not exist, so it can not run it as an annotation processor
so the compilation fails. So what I need is a means to add the file to the
jar without adding it to the compiler classpath.
Anyone got any suggestions.
David
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: maven-compiler-plugin resources not in classpath
Posted by David Goodenough <da...@btconnect.com>.
On Monday 06 April 2009, jieryn@gmail.com wrote:
> Hello David,
>
> Please review the maven-jar-plugin, specifically the includes
> parameter to the jar goal.
>
> http://maven.apache.org/plugins/maven-jar-plugin/jar-mojo.html#includes
>
> -jesse
>
> On Mon, Apr 6, 2009 at 9:47 AM, David Goodenough
>
> <da...@btconnect.com> wrote:
> > But will that not exclude it from the jar as well? I tried it and it
> > seems to have that effect. I want it excluded from the compilation but
> > included in the jar.
(newbie alert - sorry, should have flagged this before).
OK, I added:-
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<includes>
<include>target/classes/*</include>
<include>resources/*</include>
</includes>
</configuration>
</plugin>
and it only puts the META-INF/maven bits into the jar. The classes
are under target/classes, and there is a META-INF under resources.
What should I have done?
David
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: maven-compiler-plugin resources not in classpath
Posted by ji...@gmail.com.
Hello David,
Please review the maven-jar-plugin, specifically the includes
parameter to the jar goal.
http://maven.apache.org/plugins/maven-jar-plugin/jar-mojo.html#includes
-jesse
On Mon, Apr 6, 2009 at 9:47 AM, David Goodenough
<da...@btconnect.com> wrote:
> But will that not exclude it from the jar as well? I tried it and it seems
> to have that effect. I want it excluded from the compilation but included
> in the jar.
--
There are 10 types of people in this world, those
that can read binary and those that can not.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: maven-compiler-plugin resources not in classpath
Posted by David Goodenough <da...@btconnect.com>.
On Monday 06 April 2009, jieryn@gmail.com wrote:
> Hi David,
>
> If I understand the problem correctly, it will be solved by excluding
> META-INF/services/javax.annotation.processing.Processor file from your
> module resources (thereby preventing it from being put into the
> classpath). Please read http://maven.apache.org/pom.html#Resources for
> more information on how to do that.
But will that not exclude it from the jar as well? I tried it and it seems
to have that effect. I want it excluded from the compilation but included
in the jar.
David
>
> Good luck,
> -jesse
>
> On Mon, Apr 6, 2009 at 5:47 AM, David Goodenough
>
> <da...@btconnect.com> wrote:
> > I am trying to use maven to compile a java annotation processor.
> >
> > When you build a jar which contains an annotation processor you can put
> > a file (META-INF/services/javax.annotation.processing.Processor) which
> > contains one line per annotation processor. With this file in place you
> > then only have to include the jar in the javac classpath to get it to
> > process annotations, you do not have to mention it on the command line.
> >
> > Unforunately if you build your pom.xml to include this file under the
> > resources tag, it gets included in the classpath, and then the compiler
> > complains that the annotation processor it is compiling (the one
> > mentioned in the file) does not exist, so it can not run it as an
> > annotation processor so the compilation fails. So what I need is a means
> > to add the file to the jar without adding it to the compiler classpath.
> >
> > Anyone got any suggestions.
> >
> > David
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: maven-compiler-plugin resources not in classpath
Posted by ji...@gmail.com.
Hi David,
If I understand the problem correctly, it will be solved by excluding
META-INF/services/javax.annotation.processing.Processor file from your
module resources (thereby preventing it from being put into the
classpath). Please read http://maven.apache.org/pom.html#Resources for
more information on how to do that.
Good luck,
-jesse
On Mon, Apr 6, 2009 at 5:47 AM, David Goodenough
<da...@btconnect.com> wrote:
> I am trying to use maven to compile a java annotation processor.
>
> When you build a jar which contains an annotation processor you can put
> a file (META-INF/services/javax.annotation.processing.Processor) which
> contains one line per annotation processor. With this file in place you
> then only have to include the jar in the javac classpath to get it to
> process annotations, you do not have to mention it on the command line.
>
> Unforunately if you build your pom.xml to include this file under the
> resources tag, it gets included in the classpath, and then the compiler
> complains that the annotation processor it is compiling (the one mentioned
> in the file) does not exist, so it can not run it as an annotation processor
> so the compilation fails. So what I need is a means to add the file to the
> jar without adding it to the compiler classpath.
>
> Anyone got any suggestions.
>
> David
--
There are 10 types of people in this world, those
that can read binary and those that can not.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org