MojoExecutionException: 403 Forbidden error while deployong apigee service using maven plug in?

Not applicable

Hi All,

I tried to deploy apigee service using maven plugin but the build got failed. I followed the steps for build using below URL.

URL: https://github.com/apigee/apigee-deploy-maven-plugin

Please find the error trace and related pom files as attachment and help me out to resolve the issue.

errortrace.txt

pom.txtsharedpom.txtconfig.txt

0 16 3,178
16 REPLIES 16

Not applicable

Hello @kashi viswanath,

Do you know what is the role associated with the userid that you are trying to use for build ? If it is a custom role, then does it have deploy rights ?

Hi@Meghdeep Basu

Thanks for the response ,

I need to check with admin whether I have deploy rights or not.

Hi @kashi viswanath

Thanks for the attachments. Can you please confirm the mvn command you executed ? You can mask the credentials while pasting it here.

Not applicable

Hi @Saran

Below is the command im using

mvn apigee-enterprise:deploy -P test -Dusername=********* -Dpassword=*********

Not applicable

@Sai Saran Vaidyanathan

Today when i tried to deploy the proxy nothing is working, apigee jars while downloading itself failing.

Please find the error trace as attachment.

I have used the below commands but noting is working

mvn install -Ptest -Dusername=******* -Dpassword=***** -Dorg=******

mvn apigee-enterprise:deploy -P test -Dusername=******* -Dpassword=***** -Dorg=******

Could you please help me out what went wrong, i used the same pom.xml as above attached.

errortrace2.txt

HI @kashi viswanath

Can you make sure the local maven repo where you are running this has the 1.1.0 version downloaded. You can check by navigating to ~/.m2/repository/io/apigee/build-tools/enterprise4g/apigee-edge-maven-plugin/1.1.0.

If you do not see the 1.1.0 jar downloaded, please make sure your machine has access to the public central repo or else please check which version you have and use that in your pom file

If that still doesn't work, I am happy to work with you. Please send me an email to ssvaidyanathan@apigee.com and we can work on it

Not applicable

Hi @Sai Saran Vaidyanathan

I am able to see the apigee-edge-maven-plugin-1.1.0.jar in .m2 repository.

HI @kashi viswanath

Can you update pom to use 1.0.4 instead of 1.1.0 and see if that made any difference ? Without seeing the entire bundle and your machine setup, it is tough to help

Not applicable

Hi @Sai Saran Vaidyanathan

The same set up when I tried in one of my colleague machine, I am able to build and deploy the proxy. The build was successful. I don't know why it is failing in my machine.

Please find error trace below.

Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml
Downloading: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml (13 KB at 3.7 KB/sec)
Downloaded: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml (20 KB at 5.5 KB/sec)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.474 s
[INFO] Finished at: 2016-09-23T11:25:15+05:30
[INFO] Final Memory: 12M/113M
[INFO] ------------------------------------------------------------------------
[WARNING] The requested profile "test" could not be activated because it does not exist.
[ERROR] No plugin found for prefix 'apigee-enterprise' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\Users\kviswan1\.m2\repository), centra
l (https://repo.maven.apache.org/maven2)] -> [Help 1]
[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/NoPluginFoundForPrefixException

@kashi viswanath - Interesting. Do you both have the same maven version ?

Not applicable

Hi @Sai Saran Vaidyanathan

Today when I executed the mvn deploy command from the folder path

src/gateway/proxyName/ where my pom.xml exists i.e child pom.

>mvn apigee-enterprise:deploy -Ptest -Dusername=********* -Dpassword=******

The build is successful and deployed into my organization.

I don't know the behavior of this.

Request prepared for the server
**************************
POST https://api.enterprise.apigee.com/v1/organizations/viswa18/environments/test/apis/india-digital-acco...
accept: application/json
accept-encoding: gzip
authorization: Basic [Not shown in log]
[INFO]


Response returned by the server
**************************
200 OK
accept-encoding: gzip
content-length: 830
content-type: application/json
date: Fri, 23 Sep 2016 07:41:57 GMT
server: [Apigee LB]
access-control-allow-origin: [*]
access-control-allow-methods: [GET, PUT, POST, DELETE]
connection: [keep-alive]
access-control-max-age: [3628800]
access-control-allow-headers: [origin, x-requested-with, accept]
{
"aPIProxy": "india-digital-accounts",
"configuration": {
"basePath": "/",
"steps": []
},
"environment": "test",
"name": "1",
"organization": "viswa18",
"revision": "1",
"state": "deployed",
"server": [
{
"status": "deployed",
"type": [
"message-processor"
],
"uUID": "c4a83de7-a349-4f71-8f9a-f99e0d306ae7"
},
{
"status": "deployed",
"type": [
"message-processor"
],
"uUID": "09833eb3-c04d-438d-ad23-0d8a2b0363c1"
},
{
"status": "deployed",
"type": [
"router"
],
"uUID": "128875b4-2e2c-4803-ab44-ef03c2b27145"
},
{
"status": "deployed",
"type": [
"router"
],
"uUID": "d1947fa3-0689-47b5-abef-d70e6e19e815"
},
{
"status": "deployed",
"type": [
"router"
],
"uUID": "df2fbeec-b028-4d3c-bb96-a827b235166e"
}
]
}
[INFO]
Deployed revision is: 1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 22.479 s
[INFO] Finished at: 2016-09-23T13:11:57+05:30
[INFO] Final Memory: 10M/138M
[INFO] ------------------------------------------------------------------------

@kashi viswanath

Glad you solved your problem - you can ignore my answer that I just posted!

If you were previously executing mvn in the wrong directory then the profile probably wasn't being picked up properly (because the poms couldn't "find each other") hence the missing environment in the POST to deploy the proxy.

Cool it worked @kashi viswanath

You need to run the command in the same directory where you pom.xml or refer to is using -f option.

Please post if you have any questions

nmunro
New Member

Hi @kashi viswanath,

I encountered a 403 yesterday when deploying using maven.

The error I made was to specify an environment from an org different to the org I was deploying to. (Note that I wasn't running this sample or the configuration from this sample)

I could be wrong but if you look at the original error trace you supplied, the POST to apigee is missing the environment from the URL. (see Management API docs: Deploy API Proxy)

I'm not a maven expert and I haven't been able to work out exactly what is wrong - the only thing I see that you have changed from the sample is the shared pom artifactId where the github docs advise that it should be left as parent-pom but, given you changed the artifactId in the parent reference of the pom, I'm not sure that's the problem.

The profile looks ok too but maybe a review of the poms and the test profile with reference to the github sample and docs will help you to work this out.

Not applicable

I am also facing the same issue and executed in the below path also.

Why it is behaving in this way.

apigee-edge-deploy-issue.jpg

src/gateway/proxyName/ where my pom.xml exists i.e child pom.

>mvn apigee-enterprise:deploy -Ptest -Dusername=********* -Dpassword=******

checked jar files in .m2/repository

<groupId>io.apigee.build-tools.enterprise4g</groupId> <artifactId>apigee-edge-maven-plugin</artifactId> <version>1.1.3-SNAPSHOT</version>

Please suggest me how to fix this issue.

HI @Nagendra - Can you please open a new post as your issue looks different