Как запретить maven-assembly-plugin использовать старую версию в eclipse на windows - PullRequest
0 голосов
/ 02 августа 2020

Я использую eclipse Версия: 2020-06 (4.16.0) Идентификатор сборки: 20200615-1200 в среде windows 10. Когда я пытаюсь выполнить команду run maven clean compile assembly:single, сборка использует очень старую версию подключаемого модуля сборки. Несмотря на то, что я предоставил версию 3.2.0 maven-assembly-plugin в моем файле pom, сборка использует более старую версию (2.2-beta-5). Как я могу это исправить? Вот мой файл pom:

  <modelVersion>4.0.0</modelVersion>
  <groupId>auditlog</groupId>
  <artifactId>auditlog</artifactId>
  <version>1.0</version>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>
   <repositories>
    <repository>
       <id>my-local-repo</id>
       <url>file://${basedir}/lib</url>
    </repository>
   </repositories>   
<profiles>
    <profile>
     <!-- When built in OpenShift the 'openshift' profile will be used when invoking mvn. -->
     <!-- Use this profile for any OpenShift specific customization your app will need. -->
     <!-- By default that is to put the resulting archive into the 'deployments' folder. -->
     <!-- http://maven.apache.org/guides/mini/guide-building-for-different-environments.html -->
     <id>openshift</id>
     <build>
        <finalName>AuditlogApp</finalName>
        <plugins>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>3.2.0</version>
                <configuration>
                    <appendAssemblyId>false</appendAssemblyId>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <mainClass>com.ibm.amg.services.auditlog.AuditLogService</mainClass>
                        </manifest>
                    </archive>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                </configuration>
            </plugin>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-dependency-plugin</artifactId>
              <executions>
                <execution>
                  <id>copy-dependencies</id>
                  <phase>prepare-package</phase>
                  <goals>
                    <goal>copy-dependencies</goal>
                  </goals>
                  <configuration>
                    <outputDirectory>${project.build.directory}/${project.build.finalName}.lib</outputDirectory>
                  </configuration>
                </execution>
              </executions>
            </plugin>
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-jar-plugin</artifactId>
              <configuration>
                <archive>
                  <manifest>
                    <addClasspath>true</addClasspath>
                    <classpathPrefix>${project.build.finalName}.lib/</classpathPrefix>
                    <mainClass>${fully.qualified.main.class}</mainClass>
                  </manifest>
                </archive>
              </configuration>
            </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
 <dependencies>
     <!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.17</version>
    </dependency>
    <dependency>
        <groupId>org.mongodb</groupId>
        <artifactId>mongo-java-driver</artifactId>
        <version>3.12.6</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/io.grpc/grpc-all -->
    <dependency>
        <groupId>io.grpc</groupId>
        <artifactId>grpc-all</artifactId>
        <version>1.30.2</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.mockito/mockito-all -->
    <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-all</artifactId>
        <version>1.10.19</version>
        <scope>test</scope>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.powermock/powermock-api-mockito -->
    <dependency>
        <groupId>org.powermock</groupId>
        <artifactId>powermock-api-mockito</artifactId>
        <version>1.7.4</version>
        <scope>test</scope>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.powermock/powermock-module-junit4 -->
    <dependency>
        <groupId>org.powermock</groupId>
        <artifactId>powermock-module-junit4</artifactId>
        <version>2.0.7</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>proto</groupId>
        <artifactId>proto</artifactId>
        <version>1.0</version>
    </dependency>
    <dependency>
        <groupId>amglib</groupId>
        <artifactId>amglib</artifactId>
        <version>1.0</version>
    </dependency>
 </dependencies> 
</project>```
How can I fix this.  

1 Ответ

0 голосов
/ 02 августа 2020

Посмотрите на матрицу совместимости maven 3:

https://cwiki.apache.org/confluence/display/MAVEN/Maven+3.x+Plugin+Compatibility+Matrix

Сообщается версия 2.2-beta-5. Зачем вам версия 3.2.0?

...