We are trying to use apigee-config-maven-plugin to deploy targetservers, kvms, apiproducts. In the parent pom xml, instead of providing username & password from command line, we tried using credentials from Maven settings.xml as below. we are getting nullpointer exception. The same profile setup works fine for apigee-edge-maven-plugin though.
We used sample shared-pom-config xml provided in GItHub and just replaced environment details & provided credentials information from settings.xml reference. we ran install command and got NullPointer exception. If we provide username & password from command line ( similar to the sample xml file in GITHub), then it works fine.
Could you please let us know if apigee-config-maven-plugin supports reading credentials from maven settings file.
profile setup in parent/shared-pom-config xml file configuration:
<profiles> <profile> <id>dev</id> <properties> <org>org</org> <apigee.profile>dev</apigee.profile> <apigee.hosturl>https://hostname:port</apigee.hosturl> <apigee.apiversion>v1</apigee.apiversion> <apigee.org>${org}</apigee.org> <apigee.env>dev</apigee.env> <apigee.username>${settings.servers.apigeecred.username}</apigee.username> <apigee.password>${settings.servers.apigeecred.password}</apigee.password> </properties> </profile> </profiles>
Maven settings.xml entry:
<server> <id>apigeecred</id> <username>foo</username> <password>{COQLCE6DU6GtcS5P=}</password> </server>
Exception when running the job:
[ERROR] Failed to execute goal com.apigee.edge.config:apigee-config-maven-plugin:1.2.1:caches (create-config-cache) on project SurveyAPIConfig: Execution create-config-cache of goal com.apigee.edge.config:apigee-config-maven-plugin:1.2.1:caches failed. NullPointerException -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.apigee.edge.config:apigee-config-maven-plugin:1.2.1:caches (create-config-cache) on project SurveyAPIConfig: Execution create-config-cache of goal com.apigee.edge.config:apigee-config-maven-plugin:1.2.1:caches failed. at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224) 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:116) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:355) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155) at org.jvnet.hudson.maven3.launcher.Maven31Launcher.main(Maven31Launcher.java:132) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:330) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238) at jenkins.maven3.agent.Maven31Main.launch(Maven31Main.java:181) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at hudson.maven.Maven3Builder.call(Maven3Builder.java:136) at hudson.maven.Maven3Builder.call(Maven3Builder.java:71) at hudson.remoting.UserRequest.perform(UserRequest.java:120) at hudson.remoting.UserRequest.perform(UserRequest.java:48) at hudson.remoting.Request$2.run(Request.java:326) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: org.apache.maven.plugin.PluginExecutionException: Execution create-config-cache of goal com.apigee.edge.config:apigee-config-maven-plugin:1.2.1:caches failed. at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:143) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) ... 30 more Caused by: java.lang.NullPointerException at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:187) at com.google.api.client.http.HttpHeaders.setBasicAuthentication(HttpHeaders.java:616) at com.apigee.edge.config.rest.RestUtil.executeAPI(RestUtil.java:922) at com.apigee.edge.config.rest.RestUtil.getEnvConfig(RestUtil.java:299) at com.apigee.edge.config.mavenplugin.CacheMojo.getCache(CacheMojo.java:296) at com.apigee.edge.config.mavenplugin.CacheMojo.doUpdate(CacheMojo.java:130) at com.apigee.edge.config.mavenplugin.CacheMojo.execute(CacheMojo.java:219) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132) ... 31 more [ERROR]