2014-07-22 78 views
0

我試圖做一個乾淨的安裝Maven項目,但我發現一個問題。控制檯顯示此錯誤:Maven乾淨安裝問題:配置插件參數失敗

[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 

這對命令行相同的錯誤:

mvn release:prepare -Dresume=false 

這是所有項目的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> 
    <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> 

,這是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/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> 

我不知道什麼是錯的。有人能幫助我嗎?

+0

首先使用哪個Maven版本?爲什麼你使用maven-enforcer-plugin的一個極端舊版本? – khmarbaise

+0

你能告訴我們POM嗎? – JamesB

+0

maven版本是2.2.1 –

回答

1

看看POM。有人在那裏配置了maven-enforcer-plugin。不管你嘗試運行哪個命令,Maven總是會失敗,因爲maven-enforcer-plugin首先運行 - 這是確保環境是構建所需的。

調查pom.xml並搜索maven-enforcer-plugin。當您使用您的Maven版本不支持的插件版本時,上述錯誤可能會發生。如有疑問,請嘗試最新版本(1.3.1)。

這也意味着插件的本地副本已損壞。搜索$HOME/.m2/repositorymaven-enforcer-plugin*.jar並刪除整個文件夾。

+0

maven版本是2.2.1 maven-enforcer-plugin:maven-enforcer-plugin-1.0.jar –

+0

你錯了。執行者插件的版本是「1.0-beta-1」。如果你不覺得使用測試代碼來建立你的硬性的話,你應該:-) –