apigee / apigee-deploy-maven-plugin

Apache License 2.0
80 stars 167 forks source link

override buildDirectory for apigee-edge-maven-plugin #195

Closed mojtabakaramiquantium closed 2 years ago

mojtabakaramiquantium commented 2 years ago

we are trying to override the default location for apigee plugin for package:configure that reads the the zip file.

            <plugin>
                <groupId>io.apigee.build-tools.enterprise4g</groupId>
                <artifactId>apigee-edge-maven-plugin</artifactId>
                <version>2.3.1</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>

Tried this seems no luck , maven still try to read from default location ${project.build.directory} I believe

                     <execution>
                        <id>configure-bundle</id>
                        <phase>package</phase>
                        <goals>
                            <goal>configure</goal>
                        </goals>
                        <configuration>
                            <buildDirectory>${env.myvar}/target/</buildDirectory>  
                        </configuration>
                    </execution>
ssvaidyanathan commented 2 years ago

@mojtabakaramiquantium - What are you trying to do?

The configure task does more than zipping the directory. It has some tokenizing feature too as it copies over to the target directory. Once that is complete, it zips the target/apiproxy or target/apiproxy directory.

If you already have a zip and want to just deploy to Apigee. I would recommend the following:

For example, lets say the pom.xml is

<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>
        <artifactId>parent-pom</artifactId>
        <groupId>apigee</groupId>
        <version>1.0</version>
        <relativePath>../shared-pom.xml</relativePath>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <groupId>apigee</groupId>
    <artifactId>mock</artifactId>
    <version>1.0</version>
    <name>Mock-v1</name>
    <packaging>pom</packaging>
</project>

The zip name will be Mock-v1-1.0.zip. This is just an example Hope that clarifies

mojtabakaramiquantium commented 2 years ago

Thanks Sai. I needed to create the bundle and push it to apigeex with a terraform provider as part of Jenkins pipeline. I already found a fix by looking at plugin code.

this is how the fix is for future ref. I also found there is no way to override the bundle name!

            <plugin>
                <groupId>io.apigee.build-tools.enterprise4g</groupId>
                <artifactId>apigee-edge-maven-plugin</artifactId>
                <version>2.3.1</version>
                <executions>
                    <execution>
                        <id>configure-bundle</id>
                        <phase>package</phase>
                        <goals>
                            <goal>configure</goal>
                        </goals>
                        <configuration>
                            <baseDirectory>${proxyBaseDir}</baseDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>deploy-bundle</id>
                        <phase>install</phase>
                        <goals>
                            <goal>deploy</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>