Maven deployment plugin NullPointerException

Not applicable

We have an environment name which has a hyphen in it i.e. (test-region)

When using that in Maven command i.e.

mvn apigee-enterprise:deploy -Ptest-region -Dusername= -Dpassword=

We are getting following exception :

build	23-Aug-2016 14:04:23	[INFO] ------------------------------------------------------------------------
build	23-Aug-2016 14:04:23	[INFO] BUILD FAILURE
build	23-Aug-2016 14:04:23	[INFO] ------------------------------------------------------------------------
build	23-Aug-2016 14:04:23	[INFO] Total time: 2.699 s
build	23-Aug-2016 14:04:23	[INFO] Finished at: 2016-08-23T14:04:23-04:00
build	23-Aug-2016 14:04:23	[INFO] Final Memory: 10M/239M
build	23-Aug-2016 14:04:23	[INFO] ------------------------------------------------------------------------
build	23-Aug-2016 14:04:23	[WARNING] The requested profile "test-region" could not be activated because it does not exist.
build	23-Aug-2016 14:04:23	[ERROR] Failed to execute goal io.apigee.build-tools.enterprise4g:apigee-edge-maven-plugin:1.0.2:deploy (deploy-bundle) on project Test-v1: MojoExecutionException: NullPointerException -> [Help 1]
build	23-Aug-2016 14:04:23	org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal io.apigee.build-tools.enterprise4g:apigee-edge-maven-plugin:1.0.2:deploy (deploy-bundle) on project Test-v1: 
build	23-Aug-2016 14:04:23		at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
build	23-Aug-2016 14:04:23		at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
build	23-Aug-2016 14:04:23		at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
build	23-Aug-2016 14:04:23		at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
build	23-Aug-2016 14:04:23		at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
build	23-Aug-2016 14:04:23		at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
build	23-Aug-2016 14:04:23		at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
build	23-Aug-2016 14:04:23		at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
build	23-Aug-2016 14:04:23		at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
build	23-Aug-2016 14:04:23		at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
build	23-Aug-2016 14:04:23		at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
build	23-Aug-2016 14:04:23		at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
build	23-Aug-2016 14:04:23		at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
build	23-Aug-2016 14:04:23		at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
build	23-Aug-2016 14:04:23		at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
build	23-Aug-2016 14:04:23		at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
build	23-Aug-2016 14:04:23		at java.lang.reflect.Method.invoke(Method.java:606)
build	23-Aug-2016 14:04:23		at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
build	23-Aug-2016 14:04:23		at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
build	23-Aug-2016 14:04:23		at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
build	23-Aug-2016 14:04:23		at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
build	23-Aug-2016 14:04:23	Caused by: org.apache.maven.plugin.MojoExecutionException: 
build	23-Aug-2016 14:04:23		at io.apigee.buildTools.enterprise4g.mavenplugin.DeployMojo.processHelpfulErrorMessage(DeployMojo.java:373)
build	23-Aug-2016 14:04:23		at io.apigee.buildTools.enterprise4g.mavenplugin.DeployMojo.execute(DeployMojo.java:356)
build	23-Aug-2016 14:04:23		at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
build	23-Aug-2016 14:04:23		at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
build	23-Aug-2016 14:04:23		... 20 more
build	23-Aug-2016 14:04:23	Caused by: java.lang.NullPointerException
build	23-Aug-2016 14:04:23		at com.google.api.client.http.GenericUrl.<init>(GenericUrl.java:104)
build	23-Aug-2016 14:04:23		at io.apigee.buildTools.enterprise4g.rest.RestUtil.uploadBundle(RestUtil.java:366)
build	23-Aug-2016 14:04:23		at io.apigee.buildTools.enterprise4g.mavenplugin.DeployMojo.doImport(DeployMojo.java:159)
build	23-Aug-2016 14:04:23		at io.apigee.buildTools.enterprise4g.mavenplugin.DeployMojo.execute(DeployMojo.java:327)
build	23-Aug-2016 14:04:23		... 22 more
build	23-Aug-2016 14:04:23	[ERROR] 
build	23-Aug-2016 14:04:23	[ERROR] 

Is this an issue with the Maven plugin ?

We tried escaping - and added single & double quotes around it. But still were getting NullPointerException

Solved Solved
0 6 3,945
1 ACCEPTED SOLUTION

Not applicable

This issue has been resolved by fixing the problem in the pom file with few corrections in the profile setup

View solution in original post

6 REPLIES 6

Not applicable

This issue has been resolved by fixing the problem in the pom file with few corrections in the profile setup

@sankar.sekar , Glad to know this has been resolved, Would you like to post more details regarding fix so that it will be helpful for others too ? What was the setup before fix & what changes done to fix the issue ? Thank you in advance.

@Swapnil Raverkar, I am facing this same issue. Can you please post some details on how this issue got fixed? Thanks

@MNarayan

In this case, the issue was with pom.xml where the profile is not configured correctly. In the above error,it clearly says that test-region doesn't exist. If you are using the maven deployment plugin, then you need to make an entry in shared-pom.xml with the relevant profile details.

Please share some details about what exactly the issue you are facing to get more insight.

HI,

Can you help how to deploy a file to apigee cloud x using github with cicd pipeline creation . Can someone provide sample code for reference.

This question is from 2016. I suggest you post a new question if you need assistance.