我试图为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
这是所有项目的主题:
<?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 :(得分:1)
查看POM。有人在那里配置了maven-enforcer-plugin
。尝试运行哪个命令并不重要,Maven将始终失败,因为maven-enforcer-plugin
首先运行 - 它的工作是确保环境符合构建需要。
查看pom.xml
并搜索maven-enforcer-plugin
。当您使用您的Maven版本不支持的插件版本时,可能会发生上述错误。如有疑问,请尝试使用最新版本(1.3.1
)。
这也可能意味着插件的本地副本已损坏。在$HOME/.m2/repository
搜索maven-enforcer-plugin*.jar
并删除整个文件夹。