MojoExecutionException While creating a package using Maven plugin

navc88
New Member

Hi @Sai Saran Vaidyanathan,

I have created a Maven preferable folder structure as attached.

I have encountered a behavior where initially i tried to execute

1. mvn apigee-enterprise:configure -Ptest -Ddeployment.suffix=test

It gave MojoExecution exception. I have tried the maven with -X command and attached the logs for reference. I think it didint find the files on the "target/apiproxy" Null Pointer exception.

9853-mojoexception1.png

2: I tried executing

mvn package apigee-enterprise:configure -Ptest -Ddeployment.suffix=test

This executed and created a package.

3: I tried again :: mvn apigee-enterprise:configure -Ptest -Ddeployment.suffix=test

This time it got succeeded.

What i assume is automatically the target folder gets created on its own and we need not create a folder by ourselves right?

And finally I wanted to know can we just use the below command

mvn package apigee-enterprise:configure -Ptest -Ddeployment.suffix=test for creating the packages?

or simply

mvn package -Ptest -Ddeployment.suffix=test

added the pom.xml for reference.

<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">
    <modelVersion>4.0.0</modelVersion>
    <groupId>apigee</groupId>
    <artifactId>parent-pom</artifactId>
    <packaging>pom</packaging>
	<name>Account_Transaction_History</name>
    <version>1.0</version>
    <pluginRepositories>
        <pluginRepository>
            <id>central</id>
            <name>Maven Plugin Repository</name>
            <url>https://repo1.maven.org/maven2</url>
            <layout>default</layout>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
            <releases>
                <updatePolicy>never</updatePolicy>
            </releases>
        </pluginRepository>
    </pluginRepositories>
    <properties>
            <main.basedir>${project.basedir}</main.basedir>
			<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
			<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
			<org.slf4j.simpleLogger.defaultLogLevel>info</org.slf4j.simpleLogger.defaultLogLevel>
			<project.root.dir>${basedir}</project.root.dir>
			<target.root.dir>${basedir}/target</target.root.dir>
			<deployment.suffix>${user.name}</deployment.suffix>
			<commit></commit>
			<branch>a local</branch>
    </properties>


    <build>
		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>io.apigee.build-tools.enterprise4g</groupId>
					<artifactId>apigee-edge-maven-plugin</artifactId>
					<version>1.1.5</version>
				</plugin>
			</plugins>
		</pluginManagement>
        <plugins>
            <plugin>
                <artifactId>maven-clean-plugin</artifactId>
                <version>2.5</version>
            </plugin>
			<!-- run jslint -->
			<plugin>
				<groupId>com.cj.jshintmojo</groupId>
				<artifactId>jshint-maven-plugin</artifactId>
				<version>1.6.0</version>
				<executions>
					<execution>
						<id>jslint</id>
						<phase>validate</phase>
						<goals>
							<goal>lint</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<version>2.4.3</version>
					<directories>
						<directory>apiproxy/resources/jsc</directory>
					</directories>
					<reporter>checkstyle</reporter>
					<reportFile>target/jshint.html</reportFile>
				</configuration>
			</plugin>
			
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.6</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.1.6</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>test</id>
            <properties>
                <org>apidemo-eval</org>  <!-- default org, replace with default org to avoid passing parameter e.g. -Dorg testmyapi -->
                <options>validate</options>  <!-- default org, replace with default org to avoid passing parameter e.g. -Dorg testmyapi -->
                <apigee.profile>test</apigee.profile>
                <apigee.env>test</apigee.env>
                <apigee.hosturl>https://api.enterprise.apigee.com</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>
                <apigee.tokenurl>${tokenurl}</apigee.tokenurl> <!-- optional: oauth -->
                <apigee.mfatoken>${mfatoken}</apigee.mfatoken> <!-- optional: mfa -->
                <apigee.authtype>${authtype}</apigee.authtype> <!-- optional: oauth|basic(default) -->
                <apigee.bearer>${bearer}</apigee.bearer> <!-- optional: Bearer token override -->
                <apigee.refresh>${refresh}</apigee.refresh> <!-- optional: Refresh token override -->
                <apigee.clientid>${clientId}</apigee.clientid> <!-- optional: Oauth Client Id - Default is edgecli-->
                <apigee.clientsecret>${clientSecret}</apigee.clientsecret> <!-- optional: Oauth Client Secret Default is edgeclisecret-->
                <!--apigee.override.delay>10</apigee.override.delay-->
                <!--apigee.delay>1000</apigee.delay-->
            </properties>
        </profile>
        <profile>
            <id>prod</id>
            <properties>
                <org>apidemo-eval</org>  <!-- default org, replace with default org to avoid passing parameter e.g. -Dorg testmyapi -->
                <options>validate</options>  <!-- default org, replace with default org to avoid passing parameter e.g. -Dorg testmyapi -->
                <apigee.profile>prod</apigee.profile>
                <apigee.env>prod</apigee.env>
                <apigee.hosturl>https://api.enterprise.apigee.com</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>
                <apigee.tokenurl>${tokenurl}</apigee.tokenurl> <!-- optional: oauth -->
                <apigee.mfatoken>${mfatoken}</apigee.mfatoken> <!-- optional: mfa -->
                <apigee.authtype>${authtype}</apigee.authtype> <!-- optional: oauth|basic(default) -->
                <apigee.bearer>${bearer}</apigee.bearer> <!-- optional: Bearer token override -->
                <apigee.refresh>${refresh}</apigee.refresh> <!-- optional: Refresh token override -->
                <apigee.clientid>${clientId}</apigee.clientid> <!-- optional: Oauth Client Id - Default is edgecli-->
                <apigee.clientsecret>${clientSecret}</apigee.clientsecret> <!-- optional: Oauth Client Secret Default is edgeclisecret-->
                <!--apigee.override.delay>10</apigee.override.delay-->
                <!--apigee.delay>1000</apigee.delay-->
            </properties>
        </profile>
    </profiles>
</project>
0 2 297
2 REPLIES 2

HI @Naveen Chalageri

mvn package -Ptest -Ddeployment.suffix=test

should suffice

@Naveen Chalageri - did it work ? If yes, can you please accept this answer