Reputation: 1
Hi i'm a junior developer and i'm working on this project, like the title i can't link my ejb-client with the front-end (also back-end) is my first solo project, i wrote everything but i have some problems with the poms, on the foot of the topic there's the detailed maven error (sorry for format my first thread here)
Ejb Client Pom
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>it.isc</groupId>
<artifactId>ProgettoAziende</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>progettoaziende-ejb-client</artifactId>
<packaging>jar</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>progettoaziende-ejb-client</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.ibatis</groupId>
<artifactId>ibatis-core</artifactId>
<version>3.0</version>
</dependency>
<dependency>
<groupId>javax.ejb</groupId>
<artifactId>ejb-api</artifactId>
<version>3.0</version>
</dependency>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-ejb-client-bom</artifactId>
<version>7.1.1.Final</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Front End pom.xml
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>it.isc</groupId>
<artifactId>ProgettoAziende</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>progettoaziende-frontend</artifactId>
<packaging>war</packaging>
<name>progetto aziende-frontend</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<finalName>progettoaziende-frontend</finalName>
</build>
<dependencies>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts-core</artifactId>
<version>1.3.10</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts-taglib</artifactId>
<version>1.3.10</version>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts-extras</artifactId>
<version>1.3.10</version>
</dependency>
<dependency>
<groupId>it.isc</groupId>
<artifactId>progettoaziende-ejb-client</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jaxrs</artifactId>
<version>2.2.0.GA</version>
<scope>provided</scope>
</dependency>
<!-- Json Mapping -->
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jackson-provider</artifactId>
<version>2.2.0.GA</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.13</version>
</dependency>
</dependencies>
</project>
SUPER POM
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>it.isc</groupId>
<artifactId>ProgettoAziende</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>ProgettoAziende</name>
<url>http://maven.apache.org</url>
<modules>
<module>progettoaziende-be-ear</module>
<module>progettoaziende-ejb-client</module>
<module>progettoaziende-be-ejb</module>
<module>progettoaziende-frontend</module>
</modules>
<properties>
<encoding>UTF-8</encoding>
<project.build.sourceEncoding>${encoding}</project.build.sourceEncoding>
<project.reporting.outputEncoding>${encoding}</project.reporting.outputEncoding>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>it.isc</groupId>
<artifactId>progettoaziende-be-ear</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>it.isc</groupId>
<artifactId>progettoaziende-ejb-client</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>it.isc</groupId>
<artifactId>progettoaziende-be-ejb</artifactId>
<type>ejb</type>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>it.isc</groupId>
<artifactId>progettoaziende-frontend</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
EJB Module
<?xml version="1.0"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>it.isc</groupId>
<artifactId>ProgettoAziende</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<groupId>it.isc</groupId>
<artifactId>progettoaziende-be-ejb</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>progettoaziende-be-ejb</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
<version>2.3</version>
<configuration>
<ejbVersion>3.1</ejbVersion>
<archive>
<manifest>
<addClasspath>true</addClasspath>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.ibatis</groupId>
<artifactId>ibatis-core</artifactId>
<version>3.0</version>
</dependency>
<dependency>
<groupId>javax.ejb</groupId>
<artifactId>ejb-api</artifactId>
<version>3.0</version>
</dependency>
<dependency>
<groupId>it.isc</groupId>
<artifactId>progettoaziende-ejb-client</artifactId>
<type>ejb-client</type>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.ibatis</groupId>
<artifactId>ibatis-sqlmap</artifactId>
<version>2.3.4.726</version>
</dependency>
</dependencies>
</project>
MAVEN ERROR (I tried to compile the back-end module here, but is the same kind of problem with the front end, same error)
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building progettoaziende-be-ejb 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for it.isc:progettoaziende-ejb-client:jar:client:0.0.1-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.422 s
[INFO] Finished at: 2016-04-19T14:33:24+02:00
[INFO] Final Memory: 4M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project progettoaziende-be-ejb: Could not resolve dependencies for project it.isc:progettoaziende-be-ejb:jar:0.0.1-SNAPSHOT: Could not find artifact it.isc:progettoaziende-ejb-client:jar:client:0.0.1-SNAPSHOT -> [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/DependencyResolutionException
EDIT: FULL ERROR TRACE
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] ProgettoAziende
[INFO] progettoaziende-ejb-client
[INFO] progettoaziende-be-ejb
[INFO] progetto aziende-frontend
[INFO] progettoaziende-be-ear
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building ProgettoAziende 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ ProgettoAziende ---
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ ProgettoAziende ---
[INFO] Installing C:\Users\DEV\workspace\ProgettoAziende\pom.xml to C:\Users\DEV\.m2\repository\it\isc\ProgettoAziende\0.0.1-SNAPSHOT\ProgettoAziende-0.0.1-SNAPSHOT.pom
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building progettoaziende-ejb-client 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ progettoaziende-ejb-client ---
[INFO] Deleting C:\Users\DEV\workspace\ProgettoAziende\progettoaziende-ejb-client\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ progettoaziende-ejb-client ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\DEV\workspace\ProgettoAziende\progettoaziende-ejb-client\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ progettoaziende-ejb-client ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 17 source files to C:\Users\DEV\workspace\ProgettoAziende\progettoaziende-ejb-client\target\classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ progettoaziende-ejb-client ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\DEV\workspace\ProgettoAziende\progettoaziende-ejb-client\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ progettoaziende-ejb-client ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to C:\Users\DEV\workspace\ProgettoAziende\progettoaziende-ejb-client\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ progettoaziende-ejb-client ---
[INFO] Surefire report directory: C:\Users\DEV\workspace\ProgettoAziende\progettoaziende-ejb-client\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running org.progettoaziende.ejb.client.AppTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.002 sec
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ progettoaziende-ejb-client ---
[INFO] Building jar: C:\Users\DEV\workspace\ProgettoAziende\progettoaziende-ejb-client\target\progettoaziende-ejb-client-0.0.1-SNAPSHOT.jar
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ progettoaziende-ejb-client ---
[INFO] Installing C:\Users\DEV\workspace\ProgettoAziende\progettoaziende-ejb-client\target\progettoaziende-ejb-client-0.0.1-SNAPSHOT.jar to C:\Users\DEV\.m2\repository\it\isc\progettoaziende-ejb-client\0.0.1-SNAPSHOT\progettoaziende-ejb-client-0.0.1-SNAPSHOT.jar
[INFO] Installing C:\Users\DEV\workspace\ProgettoAziende\progettoaziende-ejb-client\pom.xml to C:\Users\DEV\.m2\repository\it\isc\progettoaziende-ejb-client\0.0.1-SNAPSHOT\progettoaziende-ejb-client-0.0.1-SNAPSHOT.pom
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building progettoaziende-be-ejb 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] ProgettoAziende .................................... SUCCESS [ 1.584 s]
[INFO] progettoaziende-ejb-client ......................... SUCCESS [ 9.071 s]
[INFO] progettoaziende-be-ejb ............................. FAILURE [ 0.160 s]
[INFO] progetto aziende-frontend .......................... SKIPPED
[INFO] progettoaziende-be-ear ............................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.579 s
[INFO] Finished at: 2016-04-20T09:40:23+02:00
[INFO] Final Memory: 12M/28M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project progettoaziende-be-ejb: Could not resolve dependencies for project it.isc:progettoaziende-be-ejb:jar:0.0.1-SNAPSHOT: Could not find artifact it.isc:progettoaziende-ejb-client:jar:client:0.0.1-SNAPSHOT -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project progettoaziende-be-ejb: Could not resolve dependencies for project it.isc:progettoaziende-be-ejb:jar:0.0.1-SNAPSHOT: Could not find artifact it.isc:progettoaziende-ejb-client:jar:client:0.0.1-SNAPSHOT
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:221)
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resolveProjectDependencies(LifecycleDependencyResolver.java:127)
at org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAreResolved(MojoExecutor.java:257)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:200)
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:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
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.apache.maven.project.DependencyResolutionException: Could not resolve dependencies for project it.isc:progettoaziende-be-ejb:jar:0.0.1-SNAPSHOT: Could not find artifact it.isc:progettoaziende-ejb-client:jar:client:0.0.1-SNAPSHOT
at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:211)
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:195)
... 23 more
Caused by: org.eclipse.aether.resolution.DependencyResolutionException: Could not find artifact it.isc:progettoaziende-ejb-client:jar:client:0.0.1-SNAPSHOT
at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:384)
at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:205)
... 24 more
Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Could not find artifact it.isc:progettoaziende-ejb-client:jar:client:0.0.1-SNAPSHOT
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:444)
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246)
at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:367)
... 25 more
Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact it.isc:progettoaziende-ejb-client:jar:client:0.0.1-SNAPSHOT
at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:434)
... 27 more
[ERROR]
[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/DependencyResolutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :progettoaziende-be-ejb
Upvotes: 0
Views: 1000
Reputation: 4202
So, I'm assuming you're using the progettoaziende-ejb-client module as container for your EJB API interfaces, in order to share with both your progettoaziende-frontend and progettoaziende-be-ejb modules.
As you probably already figured out, you're not generating your EJB client correctly.
Instead of having two modules, progettoaziende-be-ejb and progettoaziende-ejb-client, you should only have one module: progettoaziende-be-ejb.
Then, on the pom.xml of this module, you'd say it is an EJB module and configure your Maven EJB Plugin in order to generate an EJB client:
<artifactId>progettoaziende-be-ejb</artifactId>
<packaging>ejb</packaging>
(...)
<build>
(...)
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
<version>2.3</version>
<configuration>
(...)
<generateClient>true</generateClient>
(...)
</configuration>
</plugin>
</plugins>
(...)
</build>
Afterwards, in order to specify what your EJB client jar should or shouldn't contain, you could make use of the clientIncludes and clientExcludes elements:
<build>
(...)
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
<version>2.3</version>
<configuration>
(...)
<generateClient>true</generateClient>
<clientIncludes>
<!-- this will include all files and directories under com/foo/bar -->
<clientInclude>com/foo/bar/**</clientInclude>
<!-- this will include all files and directories under com/foo/acme -->
<clientInclude>com/foo/acme/**</clientInclude>
<!-- this will include all files under com/example -->
<clientInclude>com/example/*</clientInclude>
</clientIncludes>
<clientExcludes>
<!-- this will exclude all files under com/example -->
<clientExclude>com/example/*</clientExclude>
<!-- this will exclude all files and directories with the name
sparrow under com/jack -->
<clientExclude>com/jack/**/sparrow</clientExclude>
</clientExcludes>
</configuration>
</plugin>
</plugins>
(...)
</build>
Finally, you should:
Modify the dependency progettoaziende-ejb-client on the pom.xml of your WAR module from:
<dependency>
<groupId>it.isc</groupId>
<artifactId>progettoaziende-ejb-client</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
to:
<dependency>
<groupId>it.isc</groupId>
<artifactId>progettoaziende-be-ejb</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>ejb-client</type>
</dependency>
Upvotes: 1