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> <groupId>org.apache.myfaces.tobago</groupId> <artifactId>maven-apt-plugin</artifactId> <executions> <execution> <phase>generate-sources</phase> <configuration> <generated>.apt_generated</generated> <aptOptions>x=3</aptOptions> <target>1.5</target> <nocompile>true</nocompile> <showWarnings>true</showWarnings> </configuration> <goals> <goal>execute</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> >> <groupId>org.apache.maven.plugins</groupId> >> <artifactId>maven-antrun-plugin</artifactId> >> <execution> >> <phase>process-classes</phase> >> <configuration> >> <tasks> >> <apt ...></apt> >> </tasks> >> </configuration> >> <goals> >> <goal>run</goal> >> </goals> >> </execution> >> </executions> >> <dependencies> >> <dependency> >> <groupId>ant</groupId> >> <artifactId>ant-apt</artifactId> >> <version>SOME_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]