Anna Bot Anna Bot - 1 month ago 9
Java Question

MojoExecutionException thrown when I tried to make a copy of working project: what I'm missing?

I am trying to do extremely easy thing: just copy example project from WildFly github file by file by hands to study how it works an if I can change something. So, to study. But before any changing, I meet a troubles, because I can't build and deploy my copied project!
The example works and the copy (where I changed just artifactId in pom.xml) don't!

I can't understand what I'm missing.
I do not use any IDE, try to make project with maven by command prompt.

And I actually had the same problem with previous example (which is even simplyer), I didn't recieved an exception there, but my deployment just didn't work as expected (just didn't work at all, in spite of the fact I have clearly seen it as a sucsess deployment from the administrator console wildFly).

Here is my debug log from the console (not the whole one, just last part with errors):

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




and my 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>



Answer

Fixed: As it was adviced to me I checked server.log where I found more specific information about the failure. In my case it was EJBUserDao already existed on server sinse I deployed the example progect (which was the same, as I told, because I tried to make e copy). Undeploying the previous project helped to build new the same one.