我正在尝试fat jar
为插件创建一个以便在本地使用它(因为我在公司网络后面并且并不总是可以访问开放的互联网)。
不幸的是,打包过程失败的原因是:
Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.6:run (check-license-header) on project jacoco-maven-plugin:
An Ant BuildException has occured:
Invalid license info in: D:\jacoco-master\jacoco-maven-plugin\META-INF\m2e\lifecycle-mapping-metadata.xml;D:\jacoco-master\jacoco-maven-plugin\pom.xml;D:\jacoco-master\jacoco-maven-plugin\src\org\jacoco\maven\AbstractAgentMojo.java;D:\jacoco-master\jacoco-maven-plugin\src\org\jacoco\maven\AbstractJacocoMojo.java;D:\jacoco-master\jacoco-maven-plugin\src\org\jacoco\maven\AbstractReportMojo.java;D:\jacoco-master\jacoco-maven-plugin\src\org\jacoco\maven\AgentITMojo.java;D:\jacoco-master\jacoco-maven-plugin\src\org\jacoco\maven\AgentMojo.java;D:\jacoco-master\jacoco-maven-plugin\src\org\jacoco\maven\CheckMojo.java;D:\jacoco-master\jacoco-maven-plugin\src\org\jacoco\maven\DumpMojo.java;D:\jacoco-master\jacoco-maven-plugin\src\org\jacoco\maven\FileFilter.java;D:\jacoco-master\jacoco-maven-plugin\src\org\jacoco\maven\InstrumentMojo.java;D:\jacoco-master\jacoco-maven-plugin\src\org\jacoco\maven\MergeMojo.java;D:\jacoco-master\jacoco-maven-plugin\src\org\jacoco\maven\ReportAggregateMojo.java;D:\jacoco-master\jacoco-maven-plugin\src\org\jacoco\maven\ReportITMojo.java;D:\jacoco-master\jacoco-maven-plugin\src\org\jacoco\maven\ReportMojo.java;D:\jacoco-master\jacoco-maven-plugin\src\org\jacoco\maven\ReportSupport.java;D:\jacoco-master\jacoco-maven-plugin\src\org\jacoco\maven\RestoreMojo.java;D:\jacoco-master\jacoco-maven-plugin\src\org\jacoco\maven\RuleConfiguration.java
我使用在maven-license-plugin
这些文件之上添加许可证,但输出仍然相同!
这是 pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!--
#%L
JaCoCo :: Maven Plugin
%%
Copyright (C) 2009 - 2020 Mountainminds GmbH & Co. KG
%%
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
#L%
-->
<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>
<parent>
<groupId>org.jacoco</groupId>
<artifactId>org.jacoco.build</artifactId>
<version>0.8.5</version>
<relativePath>../org.jacoco.build</relativePath>
</parent>
<artifactId>jacoco-maven-plugin</artifactId>
<packaging>maven-plugin</packaging>
<name>JaCoCo :: Maven Plugin</name>
<description>The JaCoCo Maven Plugin provides the JaCoCo runtime agent to your tests and allows basic report creation.</description>
<prerequisites>
<maven>3.0</maven>
</prerequisites>
<!--
<licenses>
<license>
<name>Apache 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
<comments>A business-friendly OSS license</comments>
</license>
</licenses>
<organization>
<name>My Corp.</name>
<url>http://www.mycorp.org/</url>
</organization>
<inceptionYear>2014</inceptionYear>
-->
<dependencyManagement>
<dependencies>
<!-- maven-reporting-impl and slight update of version of its transitive dependency on commons-collections -->
<dependency>
<groupId>org.apache.maven.reporting</groupId>
<artifactId>maven-reporting-impl</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.2</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>${project.prerequisites.maven}</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>${project.prerequisites.maven}</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.0.22</version>
</dependency>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>file-management</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.reporting</groupId>
<artifactId>maven-reporting-api</artifactId>
<version>${project.prerequisites.maven}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.reporting</groupId>
<artifactId>maven-reporting-impl</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>org.jacoco.agent</artifactId>
<classifier>runtime</classifier>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>org.jacoco.core</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>org.jacoco.report</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.4</version>
<!-- annotations are needed only to build the plugin: -->
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>META-INF</directory>
<targetPath>META-INF</targetPath>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>assemble-all</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<executions>
<execution>
<id>default-descriptor</id>
<phase>process-classes</phase>
</execution>
<execution>
<id>help-goal</id>
<goals>
<goal>helpmojo</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
有人对这个主题有线索吗?我已经尝试过运行,mvn package -Dlicense.skipAddThirdParty=true
但这似乎对这个问题没有任何影响。
提前致谢。