gpt4 book ai didi

java - Maven包出现Ant BuildException : Invalid license info

转载 作者:行者123 更新时间:2023-12-01 18:39:26 31 4
gpt4 key购买 nike

我正在尝试为插件创建一个 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 运行,但这似乎对这个问题没有任何影响。

提前致谢。

最佳答案

您可以使用 0.8.6-SNAPSHOT 作为父级来解决该问题。

或者将文件中的“2009, 2020”替换为“2009, 2019”。

关于java - Maven包出现Ant BuildException : Invalid license info,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59969284/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com