{ Community }
  • Academy
  • Docs
  • Developers
  • Resources
    • Community Articles
    • Apigee on GitHub
    • Code Samples
    • Videos & eBooks
    • Accelerator Methodology
  • Support
  • Ask a Question
  • Spaces
    • Product Announcements
    • General
    • Edge/API Management
    • Developer Portal (Drupal-based)
    • Developer Portal (Integrated)
    • API Design
    • APIM on Istio
    • Extensions
    • Business of APIs
    • Academy/Certification
    • Adapter for Envoy
    • Analytics
    • Events
    • Hybrid
    • Integration (AWS, PCF, Etc.)
    • Microgateway
    • Monetization
    • Private Cloud Deployment
    • 日本語コミュニティ
    • Insights
    • IoT Apigee Link
    • BaaS/Usergrid
    • BaaS Transition/Migration
    • Apigee-127
    • New Customers
    • Topics
    • Questions
    • Articles
    • Ideas
    • Articles
    • Ideas
    • Leaderboard
    • Badges
  • Log in
  • Sign up

Get answers, ideas, and support from the Apigee Community

  • Home /
  • Edge/API Management /
avatar image
1
Question by Mohsin Khan · Nov 19, 2018 at 09:54 AM · 2k Views apigee edgedeploymenterrormavenmaven deploy plugingitjenkins

CICD using git, jenkin and apigee.

Hello All,

As I m trying to deploy API proxy using git and Jenkins. Below is my successful configuration.

1. I m able to connect to git (clone, pull, commit, push ) through a local computer.

2. In Jenkins job built it able to configured and take a path from git lab repository.

3. While building the job I m getting below error "Failed to getClass for io.apigee.buildTools.enterprise4g.mavenplugin.DeployMojo"

=============Now zipping the App Bundle================


[WARNING] Failed to getClass for io.apigee.buildTools.enterprise4g.mavenplugin.DeployMojo
[INFO] 
[INFO] <<< apigee-edge-maven-plugin:1.0.3:deploy (deploy-bundle) < package @ CICDDemo <<<
[INFO] 
[INFO] 
[INFO] --- apigee-edge-maven-plugin:1.0.3:deploy (deploy-bundle) @ CICDDemo ---
[INFO] 

=============Initializing Maven Deployment================


[INFO] 

=============Importing App================


[ERROR] 


* * * * * * * * * * *

This deployment could have failed for a variety of reasons.



* * * * * * * * * * *



[WARNING] Attempt to (de-)serialize anonymous class hudson.maven.reporters.MavenArtifactArchiver$2; see: https://jenkins.io/redirect/serialization-of-anonymous-classes/
[WARNING] Attempt to (de-)serialize anonymous class hudson.maven.reporters.MavenFingerprinter$1; see: https://jenkins.io/redirect/serialization-of-anonymous-classes/
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 19.548 s
[INFO] Finished at: 2018-11-19T14:58:15+05:30
[INFO] ------------------------------------------------------------------------
[WARNING] The requested profile "test" could not be activated because it does not exist.
Waiting for Jenkins to finish collecting data
[ERROR] Failed to execute goal io.apigee.build-tools.enterprise4g:apigee-edge-maven-plugin:1.0.3:deploy (deploy-bundle) on project CICDDemo: MojoExecutionException: NullPointerException -> [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/MojoExecutionException

Below is the maven pom file,
pom.txt



If you need any more infomation please let me know.

Any pointer/lead would help me here would be really appreciated. @Dino @Sai Saran Vaidyanathan @Anil Sagar @ Google @Siddharth Barahalikar

pom.txt (569 B)
Comment
Add comment Show 1
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Mohsin Khan · Nov 19, 2018 at 10:02 AM 0
Link

For reference, I have used below links, but no luck,
https://community.apigee.com/questions/18908/error-during-deployment-in-travis-apigee-edge-mave.html
https://github.com/AnuManasa05/cal-build-deploy/blob/master/Calculator-master/shared-pom.xml
https://github.com/apigee/apigee-deploy-maven-plugin/tree/master/samples

Below is the shared-pom.xml file

<!-- Copyright (C) 2014 Apigee Corporation Licensed under the Apache License, 
	Version 2.0 (the "License"); you may not use this file except in compliance 
	with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 
	Unless required by applicable law or agreed to in writing, software distributed 
	under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES 
	OR CONDITIONS OF ANY KIND, either express or implied. See the License for 
	the specific language governing permissions and limitations under the License. -->


<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">


	<!--  <parent>
		<groupId>com.myorg.maven.adp</groupId>
		<artifactId>adp-base-pom</artifactId>
		<version>1.0.16</version>
	</parent> -->
	
   <parent>
 	    <groupId>org.sonatype.oss</groupId>
    	<artifactId>oss-parent</artifactId>
    	<version>7</version>
  </parent>


	<modelVersion>4.0.0</modelVersion>
	<groupId>apigee</groupId>
	<artifactId>shared-pom</artifactId>
	<packaging>pom</packaging>
	<version>1.0</version>


	<name>shared-pom</name>
	<description>Plugin to manage configuration in Apigee</description>
	<url>http://maven.apache.org</url>


	<properties>
		<main.basedir>${project.basedir}</main.basedir>
	</properties>


	<build>
		<plugins>			
			<plugin>
				<artifactId>maven-clean-plugin</artifactId>
				<version>2.5</version>
			</plugin>
			<plugin>
				<artifactId>maven-resources-plugin</artifactId>
				<version>2.5</version>
				<executions>
					<execution>
						<phase>package</phase>
						<goals>
							<goal>copy-resources</goal>
						</goals>
						<configuration>
							<overwrite>true</overwrite>
							<encoding>UTF-8</encoding>
							<echo message="basedir parent : ${basedir}" />
							<outputDirectory>${basedir}/target/apiproxy</outputDirectory>
							<resources>
								<resource>
									<directory>apiproxy</directory>
								</resource>
							</resources>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>io.apigee.build-tools.enterprise4g</groupId>
				<artifactId>apigee-edge-maven-plugin</artifactId>
				<version>1.0.3</version>
				<executions>
					<execution>
						<id>configure-bundle</id>
						<phase>package</phase>
						<goals>
							<goal>configure</goal>
						</goals>
					</execution>
					<execution>
						<id>deploy-bundle</id>
						<phase>install</phase>
						<goals>
							<goal>deploy</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>
	<!-- This is where you add the environment specific properties under various 
		profile names -->
	<profiles>
		<profile>
			<id>dev</id>
			<properties>
				<org>enterprisemobility</org>  <!-- default org, replace with dafault org to avoid passing parameter e.g. 
					-Dorg testmyapi -->
				<options>validate</options> 	<!-- default options, replace with dafault option to avoid passing parameter 
					e.g. -Doptions=validate,update -->
				<apigee.profile>dev</apigee.profile>
				<apigee.env>dev</apigee.env>
				<apigee.hosturl>https://apigeems.persistent.com:9443</apigee.hosturl>
				<apigee.apiversion>v1</apigee.apiversion>
				<apigee.org>${org}</apigee.org>
				<apigee.username>${username}</apigee.username>
				<apigee.password>${password}</apigee.password>
				<apigee.options>${options}</apigee.options>
			</properties>
		</profile>
	</profiles>			
</project>

Close

2 Answers

  • Sort: 
avatar image
1
Best Answer

Answer by Sai Saran Vaidyanathan   · Nov 19, 2018 at 10:34 PM

@Mohsin Khan

Not sure what is the mvn command you are running. From the WARNING, looks like you are calling the maven command with the test profile "-P test" but your pom only has a "dev" profile in it. So either include a test profile in your pom or else change the mvn command you are running to use the dev profile

mvn clean install -P dev -Dorg=<org> -Dusername=<user> -Dpassword=<password>

In the pom you shared the env used is hardcoded to "dev", so make sure you have that in your Apigee organization, if not change that from

<apigee.env>dev</apigee.env>

to

<apigee.env>${env}</apigee.env>

and include that in your maven command

mvn clean install -P dev -Dorg=<org> -Dusername=<user> -Dpassword=<password> -Denv=<env>

Hope this helps

Comment
Add comment Show 6 · Link
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Mohsin Khan · Nov 20, 2018 at 08:55 AM 0
Link

Thanks, @Sai Saran Vaidyanathan for your response.

In my organization, we have 4 different environments like prod, dev, qe, uat. I'm using dev env for this demo.

I have updated my shared-pom.xml as you mention and also mention maven command used in Jenkins as follow,

install -P dev -Dusername=$apg_username -Dpassword=$apg_password -Dorg=$apg_org -Denv=$apg_env
<!-- This is where you add the environment specific properties under various profile names -->		
 <profiles>
        <profile>
          <id>dev</id>
           <properties>
                <apigee.profile>dev</apigee.profile>
                <apigee.hosturl>https://apigeems.persistent.com:9443</apigee.hosturl>
                <apigee.apiversion>v1</apigee.apiversion>
                <apigee.org>${org}</apigee.org>
                <apigee.env>${env}</apigee.env>
                <apigee.username>${username}</apigee.username>
                <apigee.password>${password}</apigee.password>
               
            </properties>
        </profile>       
		 
 </profiles>

But after building the project through Jenkins

[INFO] 

=============Now zipping the App Bundle================


[WARNING] Failed to getClass for io.apigee.buildTools.enterprise4g.mavenplugin.DeployMojo
[INFO] 
[INFO] <<< apigee-edge-maven-plugin:1.0.3:deploy (deploy-bundle) < package @ CICDDemo <<<
[INFO] 
[INFO] 
[INFO] --- apigee-edge-maven-plugin:1.0.3:deploy (deploy-bundle) @ CICDDemo ---
[INFO] 

=============Initializing Maven Deployment================


[INFO] 

=============Importing App================


[INFO] 


Request prepared for the server 
 **************************
POST  https://apigeems.persistent.com:9443/v1/organizations/enterprisemobility/apis?action=import&name=CICDDemo
accept: application/json
accept-encoding: gzip
authorization: Basic [Not shown in log]
content-type: application/octet-stream
 [Request body contains data, not shown] 

[ERROR] 404 Not Found


[ERROR] 


* * * * * * * * * * *

This deployment could have failed for a variety of reasons.



* * * * * * * * * * *



[WARNING] Attempt to (de-)serialize anonymous class hudson.maven.reporters.MavenArtifactArchiver$2; see: https://jenkins.io/redirect/serialization-of-anonymous-classes/
[WARNING] Attempt to (de-)serialize anonymous class hudson.maven.reporters.MavenFingerprinter$1; see: https://jenkins.io/redirect/serialization-of-anonymous-classes/
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.100 s
[INFO] Finished at: 2018-11-20T14:10:58+05:30
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data
[ERROR] Failed to execute goal io.apigee.build-tools.enterprise4g:apigee-edge-maven-plugin:1.0.3:deploy (deploy-bundle) on project CICDDemo: MojoExecutionException: 404 Not Found

By looking at above result is there any configuration required on Apigee server we are getting 404 Not found error. I m using Apigee OPDK v.4.17.09.00

avatar image Sai Saran Vaidyanathan ♦ Mohsin Khan   · Nov 20, 2018 at 05:54 PM 0
Link

Thanks for that info @Mohsin Khan

Few things for you to check:

  1. Can you confirm that the Mgmt API URL is correct ? Can you make a call to https://apigeems.persistent.com:9443/v1/organizations/enterprisemobility/apis and see if you are getting a response ? Probably the URL is not correct ?
  2. Can you make sure the Jenkins server has access to that Mgmt server host ?
  3. Can you run the maven command with a "-X" for debug logs, it can provide you more details?
  4. Can you run the command with "-Dhttps.protocols=TLSv1.2" (just in case if the https protocols is the issue)
avatar image Mohsin Khan Sai Saran Vaidyanathan ♦ · Nov 21, 2018 at 01:38 PM 0
Link

Thanks a lot, @Sai Saran Vaidyanathan

There was an issue with the port number here I changed it, now I'm able to build Jenkins job successfully and a proxy is deployed in Edge.


Now the question arises here is how can we deploy multiple proxies in one build.

For this, I came across your one post in the community,
https://community.apigee.com/questions/43522/deploying-apis-using-jenkins-and-apigee-maven-plug.html

As you mention that update you shared-pom.xml as mention below and point Jenkins build root to this shared-pom.xml.file and reset other two proxy as CICDdemo1 and CICDdemo2 which need to be deployed are having their individual pom.xml

<modules>
        <module>CICDdemo1</module>
        <module>CICDdemo2</module>
</modules>

After build execution, I'm getting below error you can find here build-error.txt, I have run the maven command with a "-X" to get the debug logs.

build-error.txt

Here am I on right track or do I need to make some changes. please suggest me because in local machine Jenkins workspace I have pointed to take this shared-pom.xml which it's not taking as I feel

build-error.txt (8.3 kB)
Show more comments
avatar image
0

Answer by Aswin Segu   · Nov 22, 2018 at 08:42 AM

@Mohsin Khan

Please refer to the Readme.md and Samples for the actual folder structure in the below repository

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

Alternatively, the directory structure can be seen when you download the API Proxy from Apigee Edge Dashboard

Comment
Add comment · Link
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Follow this Question

Answers Answers and Comments

121 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

CICD using apigee, RTC, Jenkins and UCD. 1 Answer

Error during deployment in maven - apigee-edge-maven-plugin:1.0.1:configure (configure-bundle-step) on project lists: null 1 Answer

Obscure risk found in a Security Audit - anyone got any mitigations? 1 Answer

Failure to do "mvn apigee-enterprise:deploy" on Windows: "Invalid resource url ref" error 1 Answer

Apigee Proxy Dependency Maven Plugin - Jenkins Error 1 Answer

  • Products
    • Edge - APIs
    • Insights - Big Data
    • Plans
  • Developers
    • Overview
    • Documentation
  • Resources
    • Overview
    • Blog
    • Apigee Institute
    • Academy
    • Documentation
  • Company
    • Overview
    • Press
    • Customers
    • Partners
    • Team
    • Events
    • Careers
    • Contact Us
  • Support
    • Support Overview
    • Documentation
    • Status
    • Edge Support Portal
    • Privacy Policy
    • Terms & Conditions
© 2021 Apigee Corp. All rights reserved. - Apigee Community Terms of Use - Powered by AnswerHub
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Create an article
  • Post an idea
  • Create an article
  • Post an idea
  • Spaces
  • Product Announcements
  • General
  • Edge/API Management
  • Developer Portal (Drupal-based)
  • Developer Portal (Integrated)
  • API Design
  • APIM on Istio
  • Extensions
  • Business of APIs
  • Academy/Certification
  • Adapter for Envoy
  • Analytics
  • Events
  • Hybrid
  • Integration (AWS, PCF, Etc.)
  • Microgateway
  • Monetization
  • Private Cloud Deployment
  • 日本語コミュニティ
  • Insights
  • IoT Apigee Link
  • BaaS/Usergrid
  • BaaS Transition/Migration
  • Apigee-127
  • New Customers
  • Explore
  • Topics
  • Questions
  • Articles
  • Ideas
  • Articles
  • Ideas
  • Badges