java - Jars 在 Nexus 中部署了两次

标签 java maven

我有一个用java开发的应用程序。我不知道为什么当我执行mvn clean install deploy时,我在nexus中部署了两次jar。我的应用程序是多模块的,我只想部署 jar 一次,因为在发布存储库中我无法部署 jar 两次。 我的java版本是8 我的maven版本是3.3.9 我认为其中一个插件部署了两次,但我不知道是哪一个。

这是我的 pom:

<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <groupId>test.muppet</groupId>
    <artifactId>muppet-master-pom</artifactId>
    <packaging>pom</packaging>
    <name>muppet-master-pom</name>
    <version>2.9.0-Delivery</version>

    <!-- Paramètres du build -->
    <properties>
        <project.build.sourceEncoding>windows-1252</project.build.sourceEncoding>
        <project.reporting.outputEncoding>windows-1252</project.reporting.outputEncoding>
        <timestamp>${maven.build.timestamp}</timestamp>
        <maven.build.timestamp.format>yyyyMMdd_HHmm</maven.build.timestamp.format>
        <!-- Le numéro de version est forgé dans le pom war à l'aide d'un appel externe à SVN -->
        <muppet.master.build.version>${project.version}-R${muppet.buildnumber}-${timestamp}</muppet.master.build.version>
        <muppet.subversion.uri>https://svn.dev.me.fr/muppet/trunk</muppet.subversion.uri>
    </properties>


    <!-- Meta informations concernant l'environnement du projet
            SVN : permet la récupéation de la révision courante au build et les opérations automatiques depuis Jenkins
                  l'url peut être surchargée au moment du build (ligne de commande)

            Distribution : Informations concernant les dépôts Nexus pour la récupération des livrables
    -->
    <scm>
        <connection>scm:svn:${muppet.subversion.uri}</connection>
        <developerConnection>scm:svn:${muppet.subversion.uri}</developerConnection>
        <url>https://svn.dev.me.fr/muppet/</url>
    </scm>
    <distributionManagement>
        <snapshotRepository>
            <id>Snapshots</id>
            <url>https://test.fr/repository/mpt-muppet-maven-snapshot/</url>
        </snapshotRepository>
        <repository>
            <id>Releases</id>
            <url>https://test.fr/repository/mpt-muppet-maven-release/</url>
        </repository>
        <site>
            <id>muppet.website</id>
            <name>Site de documentation MUPPET</name>
            <url>scp://test.fr/home/webadm/apps/apache-tomcat-7.0.20/webapps/muppet-doc/</url>
        </site>
    </distributionManagement>


    <!-- Définition des modules du projet -->
    <modules>
        <module>muppet-model-jar</module>
        <module>muppet-processor-jar</module>
        <module>muppet-core-jar</module>
        <module>muppet-mock-jar</module>
        <module>muppet-export-jar</module>
        <module>muppet-web-war</module>
        <module>muppet-main-ear</module>
        <module>muppet-distribution</module>
    </modules>

    <!-- Dépendances communes à l'ensemble des modules -->
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.8.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.thoughtworks.xstream</groupId>
            <artifactId>xstream</artifactId>
            <version>1.3.1</version>
            <scope>test</scope>
        </dependency>


    </dependencies>

    <!-- Description du build -->
    <build>
        <plugins>
           <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.5</version>
                <configuration>
                     <source>1.8</source>
                     <target>1.8</target>
                     <encoding>${project.build.sourceEncoding}</encoding>
                </configuration>
           </plugin>

            <!-- Plugin maven-release-plugin :  orchestre l'automatisation du process de release
                   Les releases sont effectuées depuis Jenkins (le type de release varie selon le job)
             -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>2.5.3</version>
                <configuration>
                    <!-- Le provider 'javasvn' permet de ne pas avoir de client SVN sur la machine hôte du build -->
                    <providerImplementations>
                        <svn>javasvn</svn>
                    </providerImplementations>
                    <branchBase>https://svn.dev.me.fr:6443/muppet/branches/</branchBase>
                    <tagBase>https://svn.dev.me.fr:6443/muppet/tags/deliveries/</tagBase>
                    <tagNameFormat>@{project.version}</tagNameFormat>
                    <username>hudsonNucThF</username>
                    <password>c43TA3xm</password>

                    <!-- Le build (y.c. tests) crée des fichier à ignorer au moment de la création d'une branche / d'un tag -->
                    <checkModificationExcludes>
                        <checkModificationExclude>**/rpcPolicyManifest</checkModificationExclude>
                        <checkModificationExclude>**/symbolMaps</checkModificationExclude>
                        <checkModificationExclude>**/traces.log</checkModificationExclude>
                        <checkModificationExclude>**/target</checkModificationExclude>
                        <checkModificationExclude>**/.sonar</checkModificationExclude>
                        <checkModificationExclude>**/muppet-data-test</checkModificationExclude>
                    </checkModificationExcludes>
                    <useReleaseProfile>false</useReleaseProfile>
                    <goals>deploy</goals>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>com.google.code.maven-scm-provider-svnjava</groupId>
                        <artifactId>maven-scm-provider-svnjava</artifactId>
                        <version>2.1.1</version>
                    </dependency>
                    <dependency>
                        <groupId>org.tmatesoft.svnkit</groupId>
                        <artifactId>svnkit</artifactId>
                        <version>1.8.5</version>
                    </dependency>
                </dependencies>
            </plugin>


            <plugin>
                <artifactId>maven-deploy-plugin</artifactId>
                <version>2.8.1</version>
                <executions>
                    <execution>
                        <id>default-deploy</id>
                        <phase>deploy</phase>
                        <goals>
                            <goal>deploy</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>



            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>1.12</version>
                <executions>
                    <execution>
                        <id>add-integration-test-source</id>
                        <phase>generate-test-resources</phase>
                        <goals>
                            <goal>add-test-source</goal>
                        </goals>
                        <configuration>
                            <sources>src/it/java</sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.19.1</version>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.maven.surefire</groupId>
                        <artifactId>surefire-junit47</artifactId>
                        <version>2.19.1</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <redirectTestOutputToFile>false</redirectTestOutputToFile>
                    <argLine>-Dfile.encoding=windows-1252 @{surefireArgLine}</argLine>
                    <!--<excludedGroups>test.muppet.IntegrationTest</excludedGroups>-->
                </configuration>
            </plugin>


            <!-- Gestion de la couverture de code pour les TU & TI
                    Les conventions précisées ici sont reprises dans la configuration des analyses SONAR (cf. Jenkins)
                    Par conséquent toute modification d'une partie doit être reportée dans l'autre
            -->
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>0.7.5.201505241946</version>
                <executions>
                    <!-- TU -->
                    <execution>
                        <id>pre-unit-test</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                        <configuration>
                            <destFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</destFile>
                            <propertyName>surefireArgLine</propertyName>
                        </configuration>
                    </execution>
                    <execution>
                        <id>post-unit-test</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                        <configuration>
                            <dataFile>${project.build.directory}/coverage-reports/jacoco-ut.exec</dataFile>
                            <outputDirectory>${project.reporting.outputDirectory}/jacoco-ut</outputDirectory>
                        </configuration>
                    </execution>
                    <!-- TI -->
                    <execution>
                        <id>pre-integration-test</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                        <configuration>
                            <destFile>${project.build.directory}/coverage-reports/jacoco-it.exec</destFile>
                            <propertyName>failsafeArgLine</propertyName>
                        </configuration>
                    </execution>
                    <execution>
                        <id>post-integration-test</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                        <configuration>
                            <dataFile>${project.build.directory}/coverage-reports/jacoco-it.exec</dataFile>
                            <outputDirectory>${project.reporting.outputDirectory}/jacoco-it</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.2</version>
            </plugin>
        </plugins>

        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>2.1.2</version>
                    <configuration>
                        <attach>false</attach>
                    </configuration>
                    <executions>
                        <execution>
                            <id>attach-sources</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>jar-no-fork</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

                <!-- Ajout de SCP pour la publication de la documentation -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-site-plugin</artifactId>
                    <version>3.5.1</version>
                    <dependencies>
                        <dependency>
                            <groupId>org.apache.maven.wagon</groupId>
                            <artifactId>wagon-ssh</artifactId>
                            <version>2.10</version>
                        </dependency>
                        <dependency>
                            <groupId>org.apache.maven.wagon</groupId>
                            <artifactId>wagon-ssh-common</artifactId>
                            <version>2.10</version>
                        </dependency>
                    </dependencies>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <!-- Génération de la Javadoc (y.c. diagrammes de classes)
         Nécessite la présence de graphviz sur le poste.
    -->
    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.10.4</version>
                <configuration>
                    <failOnError>false</failOnError>
                    <doclet>org.umlgraph.doclet.UmlGraphDoc</doclet>
                    <docletArtifact>
                        <groupId>org.umlgraph</groupId>
                        <artifactId>umlgraph</artifactId>
                        <version>5.6</version>
                    </docletArtifact>
                    <additionalparam>-views -all</additionalparam>
                    <useStandardDocletOptions>true</useStandardDocletOptions>
                </configuration>
            </plugin>
        </plugins>
    </reporting>


    <profiles>
        <!-- Profil TI : activation des tests d'intégration
                les TI étant chronophages ils ne sont pas systématiquement lancés, leur activation se fait via le profil ti
        -->
        <profile>
            <id>ti</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <version>2.19.1</version>
                        <dependencies>
                            <dependency>
                                <groupId>org.apache.maven.surefire</groupId>
                                <artifactId>surefire-junit47</artifactId>
                                <version>2.19.1</version>
                            </dependency>
                        </dependencies>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>integration-test</goal>
                                    <goal>verify</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <argLine>@{failsafeArgLine}</argLine>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>gwtSdm</id>
                <dependencies>
                    <dependency>
                        <groupId>com.google.gwt</groupId>
                        <artifactId>gwt-codeserver</artifactId>
                        <version>2.6.1</version>
                    </dependency>
                    <dependency>
                        <groupId>com.google.gwt</groupId>
                        <artifactId>gwt-dev</artifactId>
                        <version>2.6.1</version>
                    </dependency>
                </dependencies>
        </profile>
    </profiles>

     <repositories>
    <repository>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
            <id>central</id>
            <name>central</name>
            <url>http://repo1.maven.org/maven2/</url>
        </repository>
            <repository>
            <id>forge-Release</id>
            <url>https://test.fr/nexus/content/repositories/test-release/</url>
        </repository>

    </repositories>

</project>

最佳答案

尝试运行 mvn cleanDeploymvndeploy 而不是 mvn clean installdeploy

在这里查看生命周期资源 http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html

关于java - Jars 在 Nexus 中部署了两次,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58960292/

相关文章:

java - @ComponentScan basePackageClasses 有命名约定吗?

java - 当 MANIFEST.MF 中列出该类时,为什么我的 jar 会生成 NoClassDefFoundError?

java - 两个 Maven 错误 - 'Type Cannot Be Resolved' + aspect weaver.1.8.0.M1 missing

java - Maven Tomcat插件-无法调用Tomcat管理器

java - 如何用 Java 编写异常工厂

java - 使用 iTextPdf FontFactory 从/WEB-INF/resources/fonts/foobar.ttf 加载字体

java - 未找到类定义 : org/glassfish/hk2/ComponentException

java - 有 Eclipse 项目 jar 的存储库吗?

java - Maven 构建失败,无法在 org.springframework :spring-core:jar:4. 0.2.RELEASE 收集依赖项

java listFiles() 仅返回文件