0

I have following problem:

Problem

I only need a dependency to ear2-ejb module. What I have to do to get a correct dependency?

I tried this one in carApp-web with all combination of scope, but only scope-provided is accepted otherwise i get a build failure. (mvn install on ear2 has already been done)

With the following settings, i get Build Error in EAR Module (carApp). The other modules are sucessfully build. Without the dependency to ear2-ejb, there are no build errors.

<dependency>
    <groupId>com.bs</groupId>
    <artifactId>ear2-ejb</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <type>ejb</type>
    <scope>provided</scope>
</dependency>

POM of ear2-ejb

<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>ear2</artifactId>
    <groupId>com.bs</groupId>
    <version>0.0.1-SNAPSHOT</version>
</parent>

<artifactId>ear2-ejb</artifactId>
<packaging>ejb</packaging>

<name>ear2: EJB Module</name>

POM of carApp-web

<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>carApp</artifactId>
    <groupId>com.bs</groupId>
    <version>0.0.1-SNAPSHOT</version>
</parent>

<artifactId>carApp-web</artifactId>
<packaging>war</packaging>

<name>carApp: WAR Module</name>

<url>http://wildfly.org</url>
<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>

<dependencies>

    <!-- Dependency for JSON -->
    <dependency>
        <groupId>com.google.code.gson</groupId>
        <artifactId>gson</artifactId>
        <version>2.3.1</version>
    </dependency>

    <!-- Dependency on the EJB module so we can use it's services if needed -->
    <dependency>
        <groupId>com.bs</groupId>
        <artifactId>carApp-ejb</artifactId>
        <type>ejb</type>
        <scope>provided</scope>
    </dependency>

    <!-- Import the JAX-RS API, we use provided scope as the API is included 
        in JBoss WildFly -->
    <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>jaxrs-api</artifactId>
        <scope>provided</scope>
    </dependency>

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

    <!-- Import the JSF API, we use provided scope as the API is included in 
        JBoss 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 
        JBoss WildFly -->
    <dependency>
        <groupId>org.hibernate.javax.persistence</groupId>
        <artifactId>hibernate-jpa-2.1-api</artifactId>
        <scope>provided</scope>
    </dependency>

    <!-- JSR-303 (Bean Validation) Implementation -->
    <!-- Provides portable constraints such as @Email -->
    <!-- Hibernate Validator is shipped in JBoss WildFly -->
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator</artifactId>
        <scope>provided</scope>
        <exclusions>
            <exclusion>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>com.bs</groupId>
        <artifactId>ear2-ejb</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <type>ejb</type>
    </dependency>
</dependencies>

<build>
    <finalName>${project.artifactId}</finalName>
    <plugins>
        <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <version>${version.war.plugin}</version>
            <configuration>
                <!-- Java EE 7 doesn't require web.xml, Maven needs to catch up! -->
                <failOnMissingWebXml>false</failOnMissingWebXml>
            </configuration>
        </plugin>
    </plugins>
</build>

following Error:

[ERROR] Failed to execute goal org.wildfly.plugins:wildfly-maven-plugin:1.0.2.Final:deploy (default-cli) on project carApp-ear: Deployment failed and was rolled back. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.wildfly.plugins:wildfly-maven-plugin:1.0.2.Final:deploy (default-cli) on project carApp-ear: Deployment failed and was rolled back.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:355)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:160)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.wildfly.plugin.common.DeploymentExecutionException: Deployment failed and was rolled back.
at org.wildfly.plugin.deployment.standalone.StandaloneDeployment.execute(StandaloneDeployment.java:180)
at org.wildfly.plugin.deployment.AbstractDeployment.executeDeployment(AbstractDeployment.java:121)
at org.wildfly.plugin.deployment.AbstractDeployment.doExecute(AbstractDeployment.java:146)
at org.wildfly.plugin.deployment.AbstractAppDeployment.doExecute(AbstractAppDeployment.java:70)
at org.wildfly.plugin.deployment.AbstractDeployment.execute(AbstractDeployment.java:111)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 19 more
[ERROR] 
[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
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :carApp-ear

(parent) carApp - pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<!-- JBoss, Home of Professional Open Source Copyright 2013, Red Hat, Inc. 
and/or its affiliates, and individual contributors by the @authors tag. See 
the copyright.txt in the distribution for a full listing of individual contributors. 
Licensed under the Apache License, Version 2.0 (the "License"); you may not 
use this file except in compliance with the License. You may obtain a copy 
of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required 
by applicable law or agreed to in writing, software distributed under the 
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS 
OF ANY KIND, either express or implied. See the License for the specific 
language governing permissions and limitations under the License. -->
<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">
<name>carApp</name>
<modelVersion>4.0.0</modelVersion>
<groupId>com.bs</groupId>
<artifactId>carApp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>

<url>http://wildfly.org</url>
<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>
<modules>
    <module>carApp-ejb</module>
    <module>carApp-web</module>
    <module>carApp-ear</module>
</modules>

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

    <!-- Define the version of the JBoss BOMs we want to import to specify 
        tested stacks. -->
    <version.jboss.bom>8.2.1.Final</version.jboss.bom>
    <version.wildfly>9.0.0.Alpha1</version.wildfly>


    <!-- other plugin versions -->
    <version.compiler.plugin>3.1</version.compiler.plugin>
    <version.ear.plugin>2.10</version.ear.plugin>
    <version.ejb.plugin>2.3</version.ejb.plugin>
    <version.surefire.plugin>2.16</version.surefire.plugin>
    <version.war.plugin>2.5</version.war.plugin>

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

<dependencyManagement>
    <dependencies>

        <dependency>
            <groupId>com.bs</groupId>
            <artifactId>ear2-ejb</artifactId>
            <type>ejb</type>
            <version>0.0.1-SNAPSHOT</version>
        </dependency>

        <!-- Define the version of the EJB jar so that we don't need to repeat 
            ourselves in every module -->
        <dependency>
            <groupId>com.bs</groupId>
            <artifactId>carApp-ejb</artifactId>
            <version>${project.version}</version>
            <type>ejb</type>
        </dependency>

        <!-- Define the version of the WAR so that we don't need to repeat ourselves 
            in every module -->
        <dependency>
            <groupId>com.bs</groupId>
            <artifactId>carApp-web</artifactId>
            <version>${project.version}</version>
            <type>war</type>
            <scope>compile</scope>
        </dependency>

        <!-- 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-with-tools stack (you can 
            read this as the JBoss stack of the Java EE 7 APIs, with some extras tools 
            for your project, such as Arquillian for testing) and the jboss-javaee-7.0-with-hibernate 
            stack you can read this as the JBoss stack of the Java EE 7 APIs, with extras 
            from the Hibernate family of projects) -->
        <dependency>
            <groupId>org.wildfly.bom</groupId>
            <artifactId>jboss-javaee-7.0-with-tools</artifactId>
            <version>${version.jboss.bom}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>

        <dependency>
            <groupId>org.wildfly.bom</groupId>
            <artifactId>jboss-javaee-7.0-with-hibernate</artifactId>
            <version>${version.jboss.bom}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>

    </dependencies>
</dependencyManagement>

<build>
    <pluginManagement>
        <plugins>
            <!-- The WildFly plugin deploys your ear to a local JBoss AS container -->
            <!-- Due to Maven's lack of intelligence with EARs we need to configure 
                the wildfly maven plugin to skip deployment for all modules. We then enable 
                it specifically in the ear module. -->
            <plugin>
                <groupId>org.wildfly.plugins</groupId>
                <artifactId>wildfly-maven-plugin</artifactId>
                <version>${version.wildfly.maven.plugin}</version>
                <inherited>true</inherited>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
</build>

Bünyamin
  • 1
  • 1
  • please post the pom.xml main configuration of the ear2-ejb project – fmodos Feb 25 '15 at 11:02
  • Delete the scope tag. Post the complete pom.xml – José Ricardo Pla Feb 25 '15 at 11:12
  • If don't use provided and get a build failure than you build is wrong. – khmarbaise Feb 25 '15 at 12:03
  • Where can be the mistake ? without the dependency everything works well... – Bünyamin Feb 25 '15 at 13:01
  • It's not completely clear what you are trying to do. Do you want to package ear2-ejb.jar into the WEB-INF/lib directory? Or do you want ear2-ejb.jar (packaged in ear2) to be accessible from carApp-web (packaged in carApp-ear) – Steve C Feb 25 '15 at 13:35
  • what is the build failure that u get? – OhadR Feb 25 '15 at 13:47
  • ear2-ejb.jar (packaged in ear2) should be accessible from carApp-web (packaged in carApp) – Bünyamin Feb 25 '15 at 13:47
  • "Build Error in EAR Module". Which "EAR Module" do you talk about exactly? carApp-ear? Also, the error message you posted is useless. It just says "I couldn't deploy". There must be another error message which tells you **why** WildFly coudln't deploy. Find it and add that to the question. – Aaron Digulla Feb 25 '15 at 14:43
  • I have to disappoint you... but there is no other error given. – Bünyamin Feb 25 '15 at 14:52
  • From what I see, the error happens when maven try to execute the `deploy` goal with the `wildfly-maven-plugin`, but there's not config of this plugin in your `pom.xml`. It's probably defined in your parent pom, can you show us the config od the wildfly-maven-plugin? – Matt Feb 27 '15 at 09:59

0 Answers0