maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lee Meador <leemeador76...@gmail.com>
Subject Re: [m2] Generating Source in Ant
Date Thu, 17 Nov 2005 18:53:20 GMT
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 <brett.porter@gmail.com> 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 <Lee.Meador@aa.com> 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: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
>


--
-- Lee Meador
Sent from gmail. My real email address is lee@leemeador.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message