You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Vinicius Carvalho <ja...@gmail.com> on 2009/12/04 16:03:26 UTC

Ant Task: Nullpointer Exception

Hello there! I'm trying to integrate my build.xml with some artifacts
managed by maven. Here's What I've done so far:

<project name="Project Builder"
xmlns:artifact="antlib:org.apache.maven.artifact.ant">
	
	<property file="build.properties"></property>
	
	<path id="maven-ant-tasks.classpath" path="${maven.lib.dir}" />
	 <typedef resource="org/apache/maven/artifact/ant/antlib.xml"
	           uri="antlib:org.apache.maven.artifact.ant"
	           classpathref="maven-ant-tasks.classpath" />

	
	<target name="install-liquid">
		<artifact:pom file="${project.dir}/pom.xml" id="mypom" >
			
		</artifact:pom>
		
		<artifact:install
file="${project.dir}/${mypom.artifactId}-${my.version}.${mypom.packaging}"
>
			<pom pomrefid="mypompom" />
			
		</artifact:install>
	</target>
	
</project>

But running this task throws an exception

Buildfile: build.xml

install-liquid:
BUILD FAILED
java.lang.NullPointerException
	at org.apache.maven.artifact.ant.Pom.getArtifact(Pom.java:133)
	at org.apache.maven.artifact.ant.InstallTask.doExecute(InstallTask.java:53)
	at org.apache.maven.artifact.ant.AbstractArtifactTask.execute(AbstractArtifactTask.java:678)
	at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
	at org.apache.tools.ant.Task.perform(Task.java:348)
	at org.apache.tools.ant.Target.execute(Target.java:357)
	at org.apache.tools.ant.Target.performTasks(Target.java:385)
	at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
	at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
	at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
	at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
	at org.apache.tools.ant.Main.runBuild(Main.java:758)
	at org.apache.tools.ant.Main.startAnt(Main.java:217)
	at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
	at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)

Total time: 0 seconds


I've checked the source, and MavenProject is null. I did not had the
maven jar on my classpath an thought was that. But I've added it and
the problem persist.

Any idea?

Regards

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Ant Task: Nullpointer Exception

Posted by Vinicius Carvalho <ja...@gmail.com>.
Actually fixed this, by using pom inside the <artifact:install>
instead of using pomrefid.

Anyway, I started using <artifact:mvn> instead, but its downloading
all dependencies everytime. Not using my local repository. Why is
that?

Regards

On Fri, Dec 4, 2009 at 1:03 PM, Vinicius Carvalho
<ja...@gmail.com> wrote:
> Hello there! I'm trying to integrate my build.xml with some artifacts
> managed by maven. Here's What I've done so far:
>
> <project name="Project Builder"
> xmlns:artifact="antlib:org.apache.maven.artifact.ant">
>
>        <property file="build.properties"></property>
>
>        <path id="maven-ant-tasks.classpath" path="${maven.lib.dir}" />
>         <typedef resource="org/apache/maven/artifact/ant/antlib.xml"
>                   uri="antlib:org.apache.maven.artifact.ant"
>                   classpathref="maven-ant-tasks.classpath" />
>
>
>        <target name="install-liquid">
>                <artifact:pom file="${project.dir}/pom.xml" id="mypom" >
>
>                </artifact:pom>
>
>                <artifact:install
> file="${project.dir}/${mypom.artifactId}-${my.version}.${mypom.packaging}"
>>
>                        <pom pomrefid="mypompom" />
>
>                </artifact:install>
>        </target>
>
> </project>
>
> But running this task throws an exception
>
> Buildfile: build.xml
>
> install-liquid:
> BUILD FAILED
> java.lang.NullPointerException
>        at org.apache.maven.artifact.ant.Pom.getArtifact(Pom.java:133)
>        at org.apache.maven.artifact.ant.InstallTask.doExecute(InstallTask.java:53)
>        at org.apache.maven.artifact.ant.AbstractArtifactTask.execute(AbstractArtifactTask.java:678)
>        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
>        at org.apache.tools.ant.Task.perform(Task.java:348)
>        at org.apache.tools.ant.Target.execute(Target.java:357)
>        at org.apache.tools.ant.Target.performTasks(Target.java:385)
>        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
>        at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
>        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
>        at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
>        at org.apache.tools.ant.Main.runBuild(Main.java:758)
>        at org.apache.tools.ant.Main.startAnt(Main.java:217)
>        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
>        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
>
> Total time: 0 seconds
>
>
> I've checked the source, and MavenProject is null. I did not had the
> maven jar on my classpath an thought was that. But I've added it and
> the problem persist.
>
> Any idea?
>
> Regards
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Ant Task: Nullpointer Exception

Posted by Wayne Fay <wa...@gmail.com>.
>                <artifact:pom file="${project.dir}/pom.xml" id="mypom" >
>
>                        <pom pomrefid="mypompom" />
>
> java.lang.NullPointerException
>        at org.apache.maven.artifact.ant.Pom.getArtifact(Pom.java:133)


Does this help you see why it failed?

Wayne

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org