Пакет Maven Произошло исключение Ant BuildException: неверная информация о лицензии - PullRequest
0 голосов
/ 29 января 2020

Я пытаюсь создать fat jar для плагина, чтобы использовать его локально (так как я нахожусь за корпоративной сетью и не всегда имею доступ к открытому inte rnet).

К сожалению, процесс упаковки завершается неудачно из-за:

    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, но, похоже, это не повлияло на проблему.

Заранее спасибо.

1 Ответ

0 голосов
/ 06 марта 2020

Вы можете решить эту проблему, используя 0.8.6-SNAPSHOT в качестве родителя.

Или замените «2009, 2020» на «2009, 2019» в файлах.

...