Re: using apt (annotation processing) with maven 2
Just for the record, if someone else needs to use maven 2 and APT, the tobago apt-maven-plugin works fine. The only problem I have met so far, is to pass in ann env options to the processor. Seems like there is a bug here in the plugin. Example of usage: plugin groupIdorg.apache.myfaces.tobago/groupId artifactIdmaven-apt-plugin/artifactId executions execution phasegenerate-sources/phase configuration generated.apt_generated/generated aptOptionsx=3/aptOptions target1.5/target nocompiletrue/nocompile showWarningstrue/showWarnings /configuration goals goalexecute/goal /goals /execution /executions /plugin Rohnny Rohnny Moland wrote: Chris Hilton wrote: There is a source jar for an apt plugin at: http://www.mvnrepository.com/artifact/org.apache.myfaces.tobago/maven-ap t-plugin/1.0.7 Thanks, I'll try that. Couldnt find how to add classpath and such things then, but I may ask more on the myfaces mailinglist. No idea if that works, but might be worth investigating. As far as the antrun option goes, you'll need to specify the ant-apt.jar as a dependency within the antrun execution, something like: plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-antrun-plugin/artifactId execution phaseprocess-classes/phase configuration tasks apt .../apt /tasks /configuration goals goalrun/goal /goals /execution /executions dependencies dependency groupIdant/groupId artifactIdant-apt/artifactId versionSOME_VERSION/version /dependency /dependencies /plugin Unfortunately, it doesn't appear that the ant-apt jar has been loaded into the main repository, so you can either (1) go through the process to add it to the main repository, (2) do an install:install-file to install it in your local repository, (3) do a deploy:deploy-file to deploy it your company repository (you do have one, right?), or (4) make your dependency a system dependency and specify a local path. (1) would be nice so everyone else can use it but might take a while, so you'll probably need to do (2) or (3) short-term. (4) should generally be avoided, but is mentioned for completeness. Tried this one (3) but ran into class loader problems. More exact: Caused by: Error starting apt compiler at org.apache.tools.ant.taskdefs.compilers.AptCompilerAdapter.execute(Unknown Source) at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:931) at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:757) at org.apache.tools.ant.taskdefs.Apt.execute(Unknown Source) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275) at org.apache.tools.ant.Task.perform(Task.java:364) at org.apache.tools.ant.Target.execute(Target.java:341) at org.apache.maven.plugin.antrun.AbstractAntMojo.executeTasks(AbstractAntMojo.java:108) ... 19 more Caused by: java.lang.NoSuchMethodException: com.sun.tools.apt.Main.compile([Ljava.lang.String;) at java.lang.Class.getMethod(Class.java:1581) Any good ideas here are welcome. Rohnny - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: using apt (annotation processing) with maven 2
There is a source jar for an apt plugin at: http://www.mvnrepository.com/artifact/org.apache.myfaces.tobago/maven-ap t-plugin/1.0.7 No idea if that works, but might be worth investigating. As far as the antrun option goes, you'll need to specify the ant-apt.jar as a dependency within the antrun execution, something like: plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-antrun-plugin/artifactId execution phaseprocess-classes/phase configuration tasks apt .../apt /tasks /configuration goals goalrun/goal /goals /execution /executions dependencies dependency groupIdant/groupId artifactIdant-apt/artifactId versionSOME_VERSION/version /dependency /dependencies /plugin Unfortunately, it doesn't appear that the ant-apt jar has been loaded into the main repository, so you can either (1) go through the process to add it to the main repository, (2) do an install:install-file to install it in your local repository, (3) do a deploy:deploy-file to deploy it your company repository (you do have one, right?), or (4) make your dependency a system dependency and specify a local path. (1) would be nice so everyone else can use it but might take a while, so you'll probably need to do (2) or (3) short-term. (4) should generally be avoided, but is mentioned for completeness. Chris -Original Message- From: Rohnny Moland [mailto:[EMAIL PROTECTED] Sent: Thursday, 03 August, 2006 08:31 To: users@maven.apache.org Subject: using apt (annotation processing) with maven 2 Hi, I wonder if any have got the ant apt plugin to work with maven 2? Just trying to do something like this: tasks apt srcdir=${basedir}/src/main/java destdir=${basedir}/src/main/resources/component classpath=${project.compileClasspathElements} preprocessdir=${basedir}/src/main/java debug=on deprecation=off optimize=on includeAntRuntime=no nocompile=false factory=comtools.ConfigProcessorFactory /apt /tasks But I get a task not found exception because ant cannot find the ant-apt.jar (I just put in in m2/lib). Any good ideas? Or if someone knows some apt maven tool that _works_. Thanks in advance, Rohnny - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: using apt (annotation processing) with maven 2
Chris Hilton wrote: There is a source jar for an apt plugin at: http://www.mvnrepository.com/artifact/org.apache.myfaces.tobago/maven-ap t-plugin/1.0.7 Thanks, I'll try that. Couldnt find how to add classpath and such things then, but I may ask more on the myfaces mailinglist. No idea if that works, but might be worth investigating. As far as the antrun option goes, you'll need to specify the ant-apt.jar as a dependency within the antrun execution, something like: plugin groupIdorg.apache.maven.plugins/groupId artifactIdmaven-antrun-plugin/artifactId execution phaseprocess-classes/phase configuration tasks apt .../apt /tasks /configuration goals goalrun/goal /goals /execution /executions dependencies dependency groupIdant/groupId artifactIdant-apt/artifactId versionSOME_VERSION/version /dependency /dependencies /plugin Unfortunately, it doesn't appear that the ant-apt jar has been loaded into the main repository, so you can either (1) go through the process to add it to the main repository, (2) do an install:install-file to install it in your local repository, (3) do a deploy:deploy-file to deploy it your company repository (you do have one, right?), or (4) make your dependency a system dependency and specify a local path. (1) would be nice so everyone else can use it but might take a while, so you'll probably need to do (2) or (3) short-term. (4) should generally be avoided, but is mentioned for completeness. Tried this one (3) but ran into class loader problems. More exact: Caused by: Error starting apt compiler at org.apache.tools.ant.taskdefs.compilers.AptCompilerAdapter.execute(Unknown Source) at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:931) at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:757) at org.apache.tools.ant.taskdefs.Apt.execute(Unknown Source) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275) at org.apache.tools.ant.Task.perform(Task.java:364) at org.apache.tools.ant.Target.execute(Target.java:341) at org.apache.maven.plugin.antrun.AbstractAntMojo.executeTasks(AbstractAntMojo.java:108) ... 19 more Caused by: java.lang.NoSuchMethodException: com.sun.tools.apt.Main.compile([Ljava.lang.String;) at java.lang.Class.getMethod(Class.java:1581) Any good ideas here are welcome. Rohnny - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]