You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Sankaran, Nambi" <ns...@ebay.com> on 2011/12/16 08:25:26 UTC

Setting values in a mojo

Hi All

I have the following mojo, but the values are NOT getting set, by maven runtime.
The exception trace is provided below.
Have anyone faced the same problem before?

	public class Assembler1PackageMojo extends AbstractMojo {
		
		/**
		* The Maven project.
		*
		* @parameter expression="${project}"
		* @required
		* @readonly
		*/
		private MavenProject project;
		
		/**
		* Location of the file.
		*
		* @parameter expression="${project.basedir}"
		* @required
		*/
		private File projectDirectory;
		
		/**
		* Location of the file.
		*
		* @parameter expression="${project.build.directory}"
		* @required
		*/
		private File targetDirectory;
		
		/**
		 * The application name is used by the packager to create a cronus package.
		 * @parameter expression="${assembler.applicationName}"
		 * @required
		 */
		private String applicationName;
		
		/**
		 * Consumer Id (app Id).
		 * Mandatory for the time being.
		 * @parameter expression="${assembler.consumerId}" 
		 * @required
		 */
		private String consumerId;
		
		/**
		 * @parameter  default-value="cronus-pkg"
		 * @optional
		 */
		private String cronusFolder;
		

		public void execute() throws MojoExecutionException{
	    	
	    		getLog().info("Executing Assembler package mojo");
	    	
		}

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.796s
[INFO] Finished at: Thu Dec 15 22:29:47 PST 2011
[INFO] Final Memory: 5M/109M
[INFO] ------------------------------------------------------------------------
[ERROR] Internal error: java.lang.NullPointerException -> [Help 1]
org.apache.maven.InternalErrorException: Internal error: java.lang.NullPointerException
        at org.apache.maven.lifecycle.internal.BuilderCommon.handleBuildError(BuilderCommon.java:128)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:95)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        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.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: java.lang.NullPointerException
        at org.codehaus.plexus.component.configurator.converters.ComponentValueSetter.configure(ComponentValueSetter.java:331)
        at org.codehaus.plexus.component.configurator.converters.composite.ObjectWithFieldsConverter.processConfiguration(ObjectWithFieldsConverter.java:151)
        at org.codehaus.plexus.component.configurator.BasicComponentConfigurator.configureComponent(BasicComponentConfigurator.java:56)
        at org.apache.maven.plugin.internal.DefaultMavenPluginManager.populatePluginFields(DefaultMavenPluginManager.java:567)
        at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:529)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:92)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
        ... 16 more
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/InternalErrorException

Re: Setting values in a mojo

Posted by Dirk Olmes <di...@xanthippe.ping.de>.
On 12/16/2011 08:25 AM, Sankaran, Nambi wrote:
> Hi All
> 
> I have the following mojo, but the values are NOT getting set, by maven runtime.
> The exception trace is provided below.
> Have anyone faced the same problem before?

Do you build your project using the maven-plugin packaging type? For the
injection to work the Maven runtime needs additional info that's
generated by the proper packaging type.

-dirk

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