托管的ant-run-plugin

时间:2019-07-10 15:15:13

标签: java maven maven-antrun-plugin

我有以下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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>libraries</groupId>
  <artifactId>test</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <java.version>1.8</java.version>
    <maven.antrun.plugin.version>1.8</maven.antrun.plugin.version>
    <lombok.version>1.18.8</lombok.version>
    <slf4j.version>1.7.26</slf4j.version>
    <logback.version>1.2.3</logback.version>
    <junit.version>4.12</junit.version>
    <program.name>${project.artifactId}</program.name>
    <install.dir>build-application</install.dir>
  </properties>
  <build>
    <finalName>${program.name}</finalName>
    <plugins>
      <plugin>         
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>          
        <version>${maven.antrun.plugin.version}</version>       
        <executions>
          <execution>
            <id>copy jars</id>
            <phase>install</phase>
            <configuration>
              <target>
                <copy file="${project.basedir}/target/${program.name}-javadoc.jar"
                tofile="${install.dir}/${program.name}-javadoc.jar" />
                <copy file="${project.basedir}/target/${program.name}-sources.jar"
                tofile="${install.dir}/${program.name}-sources.jar" />
                <copy file="${project.basedir}/target/${program.name}.jar"
                tofile="${install.dir}/${program.name}.jar" />
              </target>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  <dependencies>
    <dependency>
      <groupId>org.projectlombok</groupId>
      <artifactId>lombok</artifactId>
      <version>${lombok.version}</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>${junit.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>${slf4j.version}</version>
    </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <version>${logback.version}</version>
    </dependency>
  </dependencies>
</project>

Spring Tool Suite 4.3.0(Eclipse clon)显示警告:

  

为maven-antrun-plugin覆盖托管版本1.3

为什么?

我没有使用任何父pom,是什么在管理我的插件版本?

在覆盖托管版本(有时我想覆盖)时如何避免出现此警告?

1 个答案:

答案 0 :(得分:0)

不是覆盖版本。上面的POM遗漏了某些部分(例如pluginManagement或父POM),或者您的Eclipse只是显示警告,指出不存在的问题(Eclipse喜欢这样做)。

如果您实际上是在覆盖某个版本(不在示例中),请忽略该警告。