使用Maven安装应用程序

时间:2018-01-02 05:10:17

标签: java maven github

当我使用命令在命令行上清理项目时 Project_path> mvn clean然后项目构建成功...当我使用命令project_path> mvn install时我得到以下问题  enter image description here

[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.13.1:generate (generate-chg-xsd) on project incode-ecp-iso20022-pain: Execution generate-chg-xsd of goal org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.13.1:generate failed: A required class was missing while executing org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.13.1:generate: com/sun/xml/bind/api/ErrorListener
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.13.1
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/Users/Mizpahsoft/.m2/repository/org/jvnet/jaxb2/maven2/maven-jaxb2-plugin/0.13.1/maven-jaxb2-plugin-0.13.1.jar
[ERROR] urls[1] = file:/C:/Users/Mizpahsoft/.m2/repository/org/jvnet/jaxb2_commons/jaxb2-namespace-prefix/1.1/jaxb2-namespace-prefix-1.1.jar
[ERROR] urls[2] = file:/C:/Users/Mizpahsoft/.m2/repository/org/jvnet/jaxb2/maven2/maven-jaxb2-plugin-core/0.13.1/maven-jaxb2-plugin-core-0.13.1.jar
[ERROR] urls[3] = file:/C:/Users/Mizpahsoft/.m2/repository/org/apache/commons/commons-lang3/3.2.1/commons-lang3-3.2.1.jar
[ERROR] urls[4] = file:/C:/Users/Mizpahsoft/.m2/repository/com/sun/org/apache/xml/internal/resolver/20050927/resolver-20050927.jar
[ERROR] urls[5] = file:/C:/Users/Mizpahsoft/.m2/repository/org/sonatype/plexus/plexus-build-api/0.0.7/plexus-build-api-0.0.7.jar
[ERROR] urls[6] = file:/C:/Users/Mizpahsoft/.m2/repository/junit/junit/4.8.1/junit-4.8.1.jar
[ERROR] urls[7] = file:/C:/Users/Mizpahsoft/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.15/plexus-utils-1.5.15.jar
[ERROR] urls[8] = file:/C:/Users/Mizpahsoft/.m2/repository/org/jvnet/jaxb2/maven2/maven-jaxb22-plugin/0.13.1/maven-jaxb22-plugin-0.13.1.jar
[ERROR] urls[9] = file:/C:/Users/Mizpahsoft/.m2/repository/org/glassfish/jaxb/jaxb-runtime/2.2.11/jaxb-runtime-2.2.11.jar
[ERROR] urls[10] = file:/C:/Users/Mizpahsoft/.m2/repository/org/glassfish/jaxb/jaxb-xjc/2.2.11/jaxb-xjc-2.2.11.jar
[ERROR] urls[11] = file:/C:/Users/Mizpahsoft/.m2/repository/org/apache/maven/plugin-tools/maven-plugin-annotations/3.4/maven-plugin-annotations-3.4.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------
[ERROR] : com.sun.xml.bind.api.ErrorListener
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException

1 个答案:

答案 0 :(得分:1)

除了清理文件夹和旧的编译残留之外,

mvn clean实际上没有做任何事情(从名称中可以清楚地看出)。

另一方面,

mvn install将尝试编译您的代码,然后在将其添加到本地存储库之前将其打包。

您的mvn install失败了,因为很明显,您的pom.xml缺少JAXB的依赖项。 修改它以包含依赖项。

在依赖项中添加以下内容:

<dependency>
    <groupId>javax.xml.bind</groupId>
    <artifactId>jaxb-api</artifactId>
    <version>2.2.12</version>
</dependency>
<dependency>
    <groupId>com.sun.xml.bind</groupId>
    <artifactId>jaxb-impl</artifactId>
    <version>2.2.11</version>
</dependency>

由于依赖关系位于maven2 central,您还需要添加以下内容(如果您的pom中已经有上述依赖项,则可能就是这种情况):

<repositories>
    <repository>
        <id>central</id>
        <url>http://repo.maven.apache.org/maven2/</url>
    </repository>
</repositories>
相关问题