这是我的自定义maven Groovy执行:
[...]
<plugin>
<groupId>org.codehaus.groovy.maven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.0-rc-5-SNAPSHOT</version>
<executions>
<execution>
<phase>prepare-package</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<classpath>
<element>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</element
</classpath>
<source>
import org.apache.commons.httpclient.HttpClient;
// ...
</source>
</configuration>
</execution>
</executions>
</plugin>
[...]
这就是Maven所说的:
[...]
[ERROR] Failed to execute goal org.codehaus.groovy.maven:gmaven-plugin:1.0-rc-5-SNAPSHOT:execute (...) on project XXX:
java.lang.ExceptionInInitializerError: org.apache.commons.logging.LogConfigurationException:
org.apache.commons.logging.LogConfigurationException:
Invalid class loader hierarchy.
You have more than one version of 'org.apache.commons.logging.Log' visible,
which is not allowed.
(Caused by org.apache.commons.logging.LogConfigurationException:
Invalid class loader hierarchy.
[...]
我认为我理解为什么会这样,但我该如何解决呢?
答案 0 :(得分:1)
如果没有看到整个pom.xml文件,很难确切地说明如何解决这个问题,但我建议查看标签。您可以使用以下内容排除额外的依赖项:
<plugin>
...
...
<dependencies>
<dependency>
<artifactId>...</artifactId>
<groupId>...</groupId>
<version>...</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
<exclusion>
</exclusions>
</dependency>
</dependencies>
</plugin>
答案 1 :(得分:1)
升级到1.3版解决了这个问题。
答案 2 :(得分:0)
检查谁使用mvn依赖项导入该依赖项:树并删除冲突。