当我试图复制工作项目时抛出MojoExecutionException:我错过了什么?

时间:2016-10-26 14:06:00

标签: java maven jboss wildfly

我正在尝试做一件非常简单的事情:只需从WildFly github文件中手工复制示例项目,以便研究它是如何工作的,如果我可以改变一些东西。所以,要学习。但在变化之前,我遇到了麻烦,因为我无法构建和部署我复制的项目! 该示例正常工作,副本(我在pom.xml中只更改了artifactId的地方)没有!

我无法理解我所缺少的东西。 我不使用任何IDE,尝试通过命令提示符使用maven创建项目。

我实际上和之前的例子(甚至更简单)有同样的问题,我没有收到异常,但我的部署没有按预期工作(只是没有尽管我已经清楚地将其视为管理员控制台wildFly的成功部署,但仍然可以工作。

以下是来自控制台的调试日志(不是整个调试日志,只是最后一部分有错误):

  INFO: JBoss Remoting version 4.0.3.Final
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD FAILURE
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time: 7.540 s
  [INFO] Finished at: 2016-10-27T13:39:24+02:00
  [INFO] Final Memory: 19M/265M
  [INFO] ------------------------------------------------------------------------
  [ERROR] Failed to execute goal org.wildfly.plugins:wildfly-maven-plugin:1.0.2.Final:deploy (default) on project wildfly-one: Deployment failed and was rolled back. -> [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/MojoExecutionException

和我的pom.xml:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<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>
<groupId>local.wildfly.one</groupId>
<artifactId>wildfly-one</artifactId>
<version>10.0.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>WildFly Proj</name>
<description>WildFly Prog</description>     

<licenses>
    <license>
        <name>Apache License, Version 2.0</name>
        <distribution>repo</distribution>
        <url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
    </license>
</licenses>

<properties>
        <!-- Explicitly declaring the source encoding eliminates the following
         message: -->
        <!-- [WARNING] Using platform encoding (UTF-8 actually) to copy filtered
         resources, i.e. build is platform dependent! -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <!-- JBoss dependency versions -->
        <version.wildfly.maven.plugin>1.0.2.Final</version.wildfly.maven.plugin>

        <version.jboss.spec.javaee.7.0>1.0.3.Final</version.jboss.spec.javaee.7.0>

        <!-- other plug-in versions -->
        <version.war.plugin>3.0.0</version.war.plugin>

        <!-- maven-compiler-plugin -->
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.compiler.source>1.8</maven.compiler.source>
    </properties>


<dependencyManagement>
    <dependencies>
        <!-- Define the version of JBoss' Java EE 7 APIs we want to import.
           Any dependencies from org.jboss.spec will have their version defined by this
           BOM -->
        <!-- JBoss distributes a complete set of Java EE 7 APIs including
           a Bill of Materials (BOM). A BOM specifies the versions of a "stack" (or
           a collection) of artifacts. We use this here so that we always get the correct
           versions of artifacts. Here we use the jboss-javaee-7.0 stack (you can
           read this as the JBoss stack of the Java EE 7 APIs). You can actually
           use this stack with any version of WildFly that implements Java EE 7, not
           just WildFly 10! -->
        <dependency>
            <groupId>org.jboss.spec</groupId>
            <artifactId>jboss-javaee-7.0</artifactId>
            <version>${version.jboss.spec.javaee.7.0}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<dependencies>

    <!-- Import the CDI API, we use provided scope as the API is included in WildFly -->
    <dependency>
         <groupId>javax.enterprise</groupId>
         <artifactId>cdi-api</artifactId>
         <scope>provided</scope>
    </dependency>

    <!-- Import the Common Annotations API (JSR-250), we use provided scope
       as the API is included in WildFly -->
    <dependency>
         <groupId>org.jboss.spec.javax.annotation</groupId>
         <artifactId>jboss-annotations-api_1.2_spec</artifactId>
         <scope>provided</scope>
    </dependency>

    <!-- Import the JSF API, we use provided scope as the API is included in WildFly -->
    <dependency>
         <groupId>org.jboss.spec.javax.faces</groupId>
         <artifactId>jboss-jsf-api_2.2_spec</artifactId>
         <scope>provided</scope>
    </dependency>

    <!-- Import the JPA API, we use provided scope as the API is included in WildFly -->
    <dependency>
         <groupId>org.hibernate.javax.persistence</groupId>
         <artifactId>hibernate-jpa-2.1-api</artifactId>
         <scope>provided</scope>
    </dependency>

    <!-- Import the JPA API, we use provided scope as the API is included in WildFly -->
    <dependency>
         <groupId>org.jboss.spec.javax.transaction</groupId>
         <artifactId>jboss-transaction-api_1.2_spec</artifactId>
         <scope>provided</scope>
    </dependency>

    <!-- Import the EJB API, we use provided scope as the API is included in WildFly -->
    <dependency>
         <groupId>org.jboss.spec.javax.ejb</groupId>
         <artifactId>jboss-ejb-api_3.2_spec</artifactId>
         <scope>provided</scope>
    </dependency>

</dependencies>

<build>
    <!-- Set the name of the WAR, used as the context root when the app
       is deployed -->
    <finalName>${project.artifactId}</finalName>
    <plugins>
        <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <version>${version.war.plugin}</version>
            <configuration>
                <!-- Java EE doesn't require web.xml, Maven needs to catch
                   up! -->
                <failOnMissingWebXml>false</failOnMissingWebXml>
            </configuration>
        </plugin>
        <!-- WildFly plug-in to deploy the WAR -->
        <plugin>
            <groupId>org.wildfly.plugins</groupId>
            <artifactId>wildfly-maven-plugin</artifactId>
            <version>${version.wildfly.maven.plugin}</version>

                            <configuration>
                <hostname>${wildfly-hostname}</hostname>
                <port>9991</port>
                <username>${wildfly-username}</username>
                <password>${wildfly-password}</password>
            </configuration>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>deploy</goal>
                    </goals>
                </execution>
         </executions>

        </plugin>
    </plugins>
</build>

1 个答案:

答案 0 :(得分:0)

修正: 正如我向我建议的那样,我检查了server.log,在那里我找到了有关失败的更具体信息。 在我的情况下,它已经存在于服务器sinse上的EJBUserDao我部署了示例progect(这是相同的,正如我所说,因为我试图制作e副本)。 取消部署以前的项目有助于构建新的项目。