简体   繁体   中英

maven-deploy-plugin not executing its execution

I need to deploy custom jar's from my project itself I overrides maven-deploy-plugin with two more execution with its default execution. below are my pom.xml with distributionManagement and maven-deploy-plugin which I use for my deployment.

<groupId>mycompany</groupId>
<artifactId>myproject</artifactId>
<packaging>jar</packaging>

<distributionManagement>
    <repository>
        <id>temp</id>
        <name>Release Repository</name>
        <url>http://localhost:8000/nexus/content/repositories/temp/</url>
    </repository>
</distributionManagement>

<dependencies>
    <dependency>
        some dependency
    </dependency>

    <dependency>
        some dependency
    </dependency>

    <dependency>
        some dependency
    </dependency>
</dependencies>
<build>
    <plugins>


        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-deploy-plugin</artifactId>
            <executions>
                <execution>
                    <id>default-deploy</id>
                    <phase>none</phase>
                </execution>

                <execution>
                    <id>myjar-one</id>
                    <phase>deploy</phase>
                    <configuration>
                        <repositoryId>temp</repositoryId>
                        <url>http://localhost:8000/nexus/content/repositories/temp/</url>
                        <packaging>jar</packaging>
                        <artifactId>myjar-one</artifactId>
                        <groupId>${project.groupId}</groupId>
                        <version>${project.version}</version>
                        <sources>${project.build.directory}/build/lib/myjar-one.jar</sources>
                    </configuration>
                </execution>


                <execution>
                    <id>myjar-two</id>
                    <phase>deploy</phase>
                    <configuration>
                        <repositoryId>temp</repositoryId>
                        <url>http://localhost:8000/nexus/content/repositories/temp/</url>
                        <packaging>jar</packaging>
                        <artifactId>myjar-two</artifactId>
                        <groupId>${project.groupId}</groupId>
                        <version>${project.version}</version>
                        <sources>${project.build.directory}/build/lib/myjar-two.jar</sources>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>


</build>

Guys I figure out the issue, there are following thing I need to fix.

  1. Need to add goal.
  2. Need to use file tag instead of source tag. So final maven-deploy-plugin looks like.

     <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-deploy-plugin</artifactId> <executions> <execution> <id>default-deploy</id> <phase>none</phase> </execution> <execution> <id>myjar-one</id> <phase>deploy</phase> <goals> <goal>deploy-file</goal> </goals> <configuration> <repositoryId>temp</repositoryId> <url>http://localhost:8000/nexus/content/repositories/temp/</url> <packaging>jar</packaging> <artifactId>myjar-one</artifactId> <groupId>${project.groupId}</groupId> <version>${project.version}</version> <file>${project.build.directory}/build/lib/myjar-one.jar</file> </configuration> </execution> <execution> <id>myjar-two</id> <phase>deploy</phase> <goals> <goal>deploy-file</goal> </goals> <configuration> <repositoryId>temp</repositoryId> <url>http://localhost:8000/nexus/content/repositories/temp/</url> <packaging>jar</packaging> <artifactId>myjar-two</artifactId> <groupId>${project.groupId}</groupId> <version>${project.version}</version> <file>${project.build.directory}/build/lib/myjar-two.jar</file> </configuration> </execution> </executions> </plugin> 

    after fixing this issue, my both custom jar's are deployed at my maven repository. Thanks for help

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM