Maven clean install issue: Failed to configure plugin parameters

混江龙づ霸主 提交于 2019-12-14 03:16:16

问题


I'm trying to made a clean install for a Maven project but I found a problem. The console displays this error:

[INFO] Failed to configure plugin parameters for: org.apache.maven.plugins:maven-enforcer-plugin:1.0

Cause: Class 'org.apache.maven.enforcer.rule.api.EnforcerRule' cannot be instantiated

It's the same error for the command line:

mvn release:prepare -Dresume=false

This is the pom of all the project:

<?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>
    <parent>
        <groupId>org.sonatype.oss</groupId>
        <artifactId>oss-parent</artifactId>
        <version>7</version>
    </parent>

    <groupId>org.aperteworkflow</groupId>
    <artifactId>aperteworkflow-core</artifactId>
    <version>2.1</version>
    <packaging>pom</packaging>

    <name>Aperte Workflow</name>
    <description>Aperte Workflow is a compilation of well-known, stable and mature frameworks into a
        complete BPM solution developed by BlueSoft sp. z o.o. - Polish independent software vendor.
        Project home page is available at http://www.aperteworkflow.org/</description>

    <modules>
        <module>core</module>
        <module>plugins</module>
        <module>utils</module>
        <module>samples</module>
        <module>vaadin-addons</module>
    </modules>

    <licenses>
        <license>
            <name>GNU Lesser General Public License, Version 2.1</name>
            <url>http://www.gnu.org/licenses/lgpl-2.1.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>
    <scm>
        <connection>scm:git:https://github.com/bluesoft-rnd/aperte-workflow-core.git</connection>
        <developerConnection>scm:git:https://github.com/bluesoft-rnd/aperte-workflow-core.git</developerConnection>
        <url>https://github.com/bluesoft-rnd/aperte-workflow-core.git</url>
    </scm>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.build.compiler.source>1.6</project.build.compiler.source>
        <project.build.compiler.target>1.6</project.build.compiler.target>
        <jbpm.version>4.4</jbpm.version>
        <spring.version>3.0.5.RELEASE</spring.version>
        <vaadin.version>6.8.3</vaadin.version>
        <hibernate.version>3.6.10.Final</hibernate.version>
        <postgres.version>8.4-702.jdbc4</postgres.version>
        <junit.version>4.8.2</junit.version>
        <liferay.version>6.1.1</liferay.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>pl.net.bluesoft</groupId>
            <artifactId>util</artifactId>
            <version>2.0</version>
        </dependency>
        <dependency>
            <groupId>commons-beanutils</groupId>
            <artifactId>commons-beanutils</artifactId>
            <version>1.8.3</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.1</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>${postgres.version}</version>
            <scope>test</scope>
        </dependency>   
        <dependency>
            <groupId>net.htmlparser.jericho</groupId>
            <artifactId>jericho-html</artifactId>
            <version>3.1</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <executions>
                        <execution>
                            <goals>
                                <goal>jar</goal>
                                <goal>test-jar</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-war-plugin</artifactId>
                    <version>2.1.1</version>
                </plugin>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <source>${project.build.compiler.source}</source>
                        <target>${project.build.compiler.target}</target>
                        <encoding>${project.build.sourceEncoding}</encoding>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-release-plugin</artifactId>
                    <configuration>
                        <pushChanges>false</pushChanges>
                        <mavenExecutorId>forked-path</mavenExecutorId>
                    </configuration>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-gpg-plugin</artifactId>
                    <executions>
                        <execution>
                            <id>sign-artifacts</id>
                            <phase>verify</phase>
                            <goals>
                                <goal>sign</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

</project>

and this is the pom of plugin test subproject:

<?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/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <parent>
        <artifactId>plugins</artifactId>
        <groupId>org.aperteworkflow</groupId>
        <version>2.0</version>
    </parent>
   <groupId>org.aperteworkflow</groupId>
   <artifactId>plugins-test</artifactId>
   <packaging>jar</packaging>
   <version>2.0</version>
   <name>A sample test case for Infinispan</name>
   <url>http://www.myorganization.org</url>


   <properties>
      <!--
         Which Infinispan version do you want to use?  Released versions are always more reliable than snapshots!
      -->
      <version.infinispan>5.1.3.FINAL</version.infinispan>


      <!-- the default JGroups protocol stack to use -->
      <infinispan.test.jgroups.protocol>tcp</infinispan.test.jgroups.protocol>
      <!-- the default transaction manager to use -->
      <infinispan.test.jta.tm>dummytm</infinispan.test.jta.tm>

      <!-- Versions of dependencies -->
      <version.commons.logging>1.1</version.commons.logging>
      <version.easymock>2.4</version.easymock>
      <version.easymockclassext>2.4</version.easymockclassext>
      <version.jbossjta>4.16.2.Final</version.jbossjta>
      <version.log4j>1.2.16</version.log4j>
      <version.testng>5.11</version.testng>
      <version.xstream>1.4.1</version.xstream>
   </properties>

   <dependencies>
           <dependency>
            <groupId>org.aperteworkflow</groupId>
            <artifactId>jbpm-context</artifactId>
            <version>2.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.aperteworkflow</groupId>
            <artifactId>integration-interface</artifactId>
            <version>2.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>${hibernate.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
            <version>1.4.3</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.aperteworkflow</groupId>
            <artifactId>integration</artifactId>
            <version>2.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.aperteworkflow</groupId>
            <artifactId>bpm-notifications</artifactId>
            <version>2.0</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>${hibernate.version}</version>
            <scope>compile</scope>
            <exclusions>
                <exclusion>
                    <groupId>javax.transaction</groupId>
                    <artifactId>jta</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>javax.transaction</groupId>
            <artifactId>jta</artifactId>
            <version>1.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.tomcat</groupId>
            <artifactId>catalina</artifactId>
            <version>6.0.18</version>
        </dependency>
   </dependencies>

   <build>
      <plugins>
         <!-- enforce java 1.6 and maven 2.1.0 -->
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-enforcer-plugin</artifactId>
            <version>1.0-beta-1</version>
            <executions>
               <execution>
                  <id>enforce-java</id>
                  <goals>
                     <goal>enforce</goal>
                  </goals>
                  <configuration>
                     <rules>
                        <requireJavaVersion>
                           <version>[1.6,)</version>
                        </requireJavaVersion>
                        <requireMavenVersion>
                           <version>[2.1.0,)</version>
                        </requireMavenVersion>
                     </rules>
                  </configuration>
               </execution>
            </executions>
         </plugin>

         <!-- by default, compile to JDK 1.6 compatibility -->
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.1</version>
            <configuration>
               <source>1.6</source>
               <target>1.6</target>
               <encoding>UTF-8</encoding>
            </configuration>
         </plugin>
      </plugins>
   </build>
</project>

I don't know what's wrong. Can someone help me please?


回答1:


Look into the POM. Someone configured the maven-enforcer-plugin in there. It doesn't matter which command you try to run, Maven will always fail because the maven-enforcer-plugin runs first - it's job is to make sure the environment is what the build needs.

Look into the pom.xml and search for maven-enforcer-plugin. The error above can happen when you use a version of the plugin which isn't supported by your version of Maven. If in doubt, try the latest version (1.3.1).

It can also mean that the local copy of the plugin is corrupt. Search $HOME/.m2/repository for maven-enforcer-plugin*.jar and delete the whole folder.



来源:https://stackoverflow.com/questions/24883102/maven-clean-install-issue-failed-to-configure-plugin-parameters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!