Does the sourceRoot defined in the antRun get added to the maven-compiler-plugin source path?
Lee Meador-2 wrote: > > Never mind. But I do have a question down there ... > > Although I had fun poking around into maven2 and creating a plugin of my > own > that would compile, load and run (even though it did die with a NPE), two > things: > > 1) It took me a while to find and load the plugin sources. I found no > reference in the docs. The page that tells how to build the source does > not > load the plugin source from subversion. Its at: > > http://maven.apache.org/guides/development/guide-building-m2.html > > I don't really know how it should be documented. I've only been looking at > this since yesterday. Maybe a sibling page that tells how to download > source > and build/install/etc the plugin source. > > The command to load the plugin source is: > > svn co https://svn.apache.org/repos/asf/maven/plugins/trunk maven-plugins > > All the plugins will get put under the 'maven-plugins' folder. > > 2) The antrun plugin has what I need already. I found that out when I > looked > at the AntRunMojo.java file. > > For what I am working on, I need to run Ant to generate my Websphere > 6.0java from a wsdl. Then I need the generated code to be compiled. > The default > case doesn't find the generated code. (I don't know why I thought it would > but maven seems to read minds sometimes.) > > I have the ant build put the code it creates in > target/generated-sources/java. > > Then I just use the <sourceRoot> tag (or <testSourceRoot> for test code) > to > tell maven2 to compile the stuff in the folder that I put in there. I > don't > know if you can put more than one relative path in there. I doubt it but > don't understand the implications of what's in the java source very well. > > This is the plugin tag from my POM. > > <plugin> > <artifactId>maven-antrun-plugin</artifactId> > <executions> > <execution> > <phase>generate-sources</phase> > <configuration> > <tasks> > <ant antfile="build.xml" dir="." target="wasWsdl2Java" inheritRefs="true" > /> > </tasks> > <sourceRoot>/target/generated-sources/java</sourceRoot> > </configuration> > <goals> > <goal>run</goal> > </goals> > </execution> > </executions> > </plugin> > > > Question: Is there a way to parameterize the folder in that tag so that I > don't put "target" but put something that will use whatever the build > directory should be? > > Thanks. > > -- Lee Meador > > On 11/17/05, Lee Meador <[EMAIL PROTECTED]> wrote: >> >> I have this source: >> >> /** >> * Goal which runs ant and then adds some path to the compile source root >> list >> * >> * @goal run >> * @phase generate-sources >> * @description Run ant and then add a folder to the list of places that >> hold >> * code to compile >> */ >> public class AntRunAddGenerateMojo extends AntRunMojo { >> >> /** >> * The Maven project. >> * >> * @parameter expression="${project}" >> * @required >> * @readonly >> */ >> private MavenProject project; >> >> /** >> * Where the source files were put by the ant task >> * >> * @parameter expression="${project.build.directory >> }/generated-sources/java" >> * @required >> */ >> private String compileSourceRoot; >> >> public void execute() throws MojoExecutionException { >> getLog().info("enter execute()"); >> super.execute(); >> getLog().info("add compileSourceRoot: " + compileSourceRoot); >> project.addCompileSourceRoot(compileSourceRoot); >> getLog().info("exit execute()"); >> } >> } >> >> And I get this error: >> >> [INFO] task-segment: [compile] >> [INFO] >> ---------------------------------------------------------------------------- >> [INFO] [ant-generate:run {execution: default}] >> [INFO] enter execute() >> [INFO] >> ---------------------------------------------------------------------------- >> [ERROR] BUILD ERROR >> [INFO] >> ---------------------------------------------------------------------------- >> [INFO] Error executing ant tasks >> >> [INFO] >> ---------------------------------------------------------------------------- >> [INFO] Trace >> org.apache.maven.lifecycle.LifecycleExecutionException: Error executing >> ant tasks >> at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals( >> DefaultLifecycleExecutor.java:544) >> at >> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle >> (DefaultLifecycleExecutor.java:469) >> at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal( >> DefaultLifecycleExecutor.java:448) >> at >> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures >> (DefaultLifecycleExecutor.java:301) >> at >> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments >> (DefaultLifecycleExecutor.java:268) >> at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute( >> DefaultLifecycleExecutor.java:137) >> at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:316) >> at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:113) >> at org.apache.maven.cli.MavenCli.main(MavenCli.java:249) >> at sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod) >> at sun.reflect.NativeMethodAccessorImpl.invoke( >> NativeMethodAccessorImpl.java:39) >> at sun.reflect.DelegatingMethodAccessorImpl.invoke( >> DelegatingMethodAccessorImpl.java:25) >> at java.lang.reflect.Method.invoke(Method.java:585) >> at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315) >> at org.codehaus.classworlds.Launcher.launch(Launcher.java:255) >> at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430) >> >> at org.codehaus.classworlds.Launcher.main(Launcher.java:375) >> Caused by: org.apache.maven.plugin.MojoExecutionException: Error >> executing >> ant tasks >> at org.apache.maven.plugin.antrun.AbstractAntMojo.executeTasks( >> AbstractAntMojo.java:77) >> at org.apache.maven.plugin.antrun.AntRunMojo.execute(AntRunMojo.java:72) >> >> at com.aa.inflightsales.maven.AntRunAddGenerateMojo.execute( >> AntRunAddGenerateMojo.java:52) >> at org.apache.maven.plugin.DefaultPluginManager.executeMojo( >> DefaultPluginManager.java:399) >> at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals( >> DefaultLifecycleExecutor.java:519) >> ... 16 more >> Caused by: java.lang.NullPointerException >> at org.apache.maven.plugin.antrun.AbstractAntMojo.executeTasks( >> AbstractAntMojo.java:42) >> ... 20 more >> [INFO] >> ---------------------------------------------------------------------------- >> [INFO] Total time: 3 seconds >> [INFO] Finished at: Thu Nov 17 12:36:57 CST 2005 >> [INFO] Final Memory: 4M/8M >> [INFO] >> ---------------------------------------------------------------------------- >> >> I have no idea how to start looking at this. Do you have any strategies >> for me? >> >> Thanks. >> >> -- Lee Meador >> >> On 11/16/05, Brett Porter <[EMAIL PROTECTED]> wrote: >> > >> > I'd recommend writing the plugin in Java and calling the Ant task >> > using the Java API, then add the source root. This would help to >> > encapsulate the functionality. >> > >> > - Brett >> > >> > On 11/17/05, Lee Meador < [EMAIL PROTECTED]> wrote: >> > > I've scanned the last couple of weeks' messages and I think I see >> what >> > > is happening. >> > > >> > > I have an ant task that generates java from a wsdl using Websphere >> 6.0's >> > >> > > ant tasks to do so. It's similar to the Axis ones. >> > > >> > > I have it generate the java into target/generated-sources/java. >> > > >> > > The generated code doesn't get compiled when I do a >> > > >> > > mvn compile >> > > >> > > I think the problem is that generated-sources doesn't get added to >> the >> > > compileSourceRoots since they are being generated in ant. >> > > >> > > So ... can I run some useless plugin with no input and get the >> > > generated-sources added to the list of roots? Is there some other way >> > to >> > > get it to look there? >> > > >> > > Thanks. >> > > >> > > -- Lee Meador >> > > >> > > >> > > --------------------------------------------------------------------- >> > > To unsubscribe, e-mail: [EMAIL PROTECTED] >> > > For additional commands, e-mail: [EMAIL PROTECTED] >> > > >> > > >> > >> > >> >> >> -- >> -- Lee Meador >> Sent from gmail. My real email address is [EMAIL PROTECTED] > > > > > -- > -- Lee Meador > Sent from gmail. My real email address is [EMAIL PROTECTED] > > -- View this message in context: http://www.nabble.com/-m2--Generating-Source-in-Ant-tf567623.html#a6098498 Sent from the Maven - Users forum at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]