Hallo,
ich möchte Maven3 verwenden, habe aber noch ein kleines Problem. Hier kleine HelloWorld Beispiel Projekte, mit denen ich mein Ziel erreichen möchte:
MavenParentProject ( pom )
- MavenEJB ( jar - module : Impl des Interfaces aus dem MavenEJBClient Modul )
- MavenEJBClient ( jar - module : Benötigtes Interface für Client Module, event. andere Projekte, die die EJB nutzen wollen )
- MavenEnterprise ( ear - module )
- MavenWeb ( war - module )
Als Anhang habe ich das Projekt mit den Modulen gezippt beigelegt ( Eclipse Projekte ). Falls jemand live damit herumtesten möchte.
Was habe ich mir Toolseitig eingerichtet:
Ich nutze Eclipse Indigo, habe das m2e Eclipse Plugin installiert, ein externes Maven mir installiert und in Eclipse einkonfiguiert.
Die Projekte hab ich über m2e mir anlegen lassen ( Basis jeweils "Create a simple project" ). Die Maven Ausführung hab ich extern über ne tty vorgenommen.
Hier die POM's der Projekte
MavenParentProject
[XML]<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>de.maven.example</groupId>
<artifactId>MavenParentProject</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>MavenParentProject</name>
<description>This is the parent pom project</description>
<modules>
<module>MavenEJB</module>
<module>MavenEJBClient</module>
<module>MavenEnterprise</module>
<module>MavenWeb</module>
</modules>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0-RC2</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>[/XML]
MavenEJB
[XML]<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>
<parent>
<artifactId>MavenParentProject</artifactId>
<groupId>de.maven.example</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>MavenEJB</artifactId>
<name>MavenEJB</name>
<description>Simple EJB for Demonstration</description>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>MavenEJBClient</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>[/XML]
MavenEJBClient
[XML]<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>
<parent>
<artifactId>MavenParentProject</artifactId>
<groupId>de.maven.example</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>MavenEJBClient</artifactId>
<name>MavenEJBClient</name>
<description>EJBClient library</description>
</project>[/XML]
MavenEnterprise
[XML]<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>
<parent>
<artifactId>MavenParentProject</artifactId>
<groupId>de.maven.example</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>MavenEnterprise</artifactId>
<packaging>ear</packaging>
<name>MavenEnterprise</name>
<description>Enterprise project ( EAR )</description>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>MavenEJBClient</artifactId>
<version>${project.version}</version>
<type>ejb-client</type>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>MavenEJB</artifactId>
<version>${project.version}</version>
<type>ejb</type>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>MavenWeb</artifactId>
<version>${project.version}</version>
<type>war</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.7</version>
<configuration>
<!-- configuration elements goes here -->
<defaultLibBundleDir>lib</defaultLibBundleDir>
<version>6</version>
<modules>
<ejbModule>
<groupId>de.maven.example</groupId>
<artifactId>MavenEJB</artifactId>
</ejbModule>
<ejbClientModule>
<groupId>de.maven.example</groupId>
<artifactId>MavenEJBClient</artifactId>
</ejbClientModule>
<webModule>
<groupId>de.maven.example</groupId>
<artifactId>MavenWeb</artifactId>
<bundleFileName>ROOT.war</bundleFileName>
</webModule>
</modules>
</configuration>
</plugin>
</plugins>
</build>
</project>[/XML]
Hier bekomme ich eine Fehlermeldung von Eclipse bei "<plugin>":
Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-ear-plugin:
2.7:generate-application-xml (execution: default-generate-application-xml, phase: generate-resources)
Kennt jemand den Hintergrund? Habe mal gehört, dass das m2e Plugin nicht ganz einwandfrei funktioniert ?! ?!
MavenWeb
[XML]<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>
<parent>
<artifactId>MavenParentProject</artifactId>
<groupId>de.maven.example</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>MavenWeb</artifactId>
<packaging>war</packaging>
<name>MavenWeb</name>
<description>Simple Web Application</description>
</project>[/XML]
Zu Beginn habe ich innerhalb der einzelnen Module (außer Enterprise Modul) ein mvn install ausgeführt. Dies erfolgte überall fehlerfrei und fand jeweils das erzeugte Jar/War im lokalen Maven Repository.
Danach hab ich im Enterprise Modul ein mvn package ausgeführt, bekomme aber Folgenden Fehler:
Leider verstehe ich das nicht, da die MavenEJBClient.jar im lokalen Repository in der angegebenen Version abgelegt wurde - also vorhanden ist ?!
Wer kann mir helfen??? Das wäre prima.
Kann ich über das ParentProject alles auf einmal "bauen" lassen? Also nicht erst alles einzelnd (außer EAR Modul) und abschließend das EAR Modul? Ich hoffe ihr wisst was ich meine ( ist schon spät )
ich möchte Maven3 verwenden, habe aber noch ein kleines Problem. Hier kleine HelloWorld Beispiel Projekte, mit denen ich mein Ziel erreichen möchte:
MavenParentProject ( pom )
- MavenEJB ( jar - module : Impl des Interfaces aus dem MavenEJBClient Modul )
- MavenEJBClient ( jar - module : Benötigtes Interface für Client Module, event. andere Projekte, die die EJB nutzen wollen )
- MavenEnterprise ( ear - module )
- MavenWeb ( war - module )
Als Anhang habe ich das Projekt mit den Modulen gezippt beigelegt ( Eclipse Projekte ). Falls jemand live damit herumtesten möchte.
Was habe ich mir Toolseitig eingerichtet:
Ich nutze Eclipse Indigo, habe das m2e Eclipse Plugin installiert, ein externes Maven mir installiert und in Eclipse einkonfiguiert.
Die Projekte hab ich über m2e mir anlegen lassen ( Basis jeweils "Create a simple project" ). Die Maven Ausführung hab ich extern über ne tty vorgenommen.
Hier die POM's der Projekte
MavenParentProject
[XML]<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>de.maven.example</groupId>
<artifactId>MavenParentProject</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>MavenParentProject</name>
<description>This is the parent pom project</description>
<modules>
<module>MavenEJB</module>
<module>MavenEJBClient</module>
<module>MavenEnterprise</module>
<module>MavenWeb</module>
</modules>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0-RC2</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>[/XML]
MavenEJB
[XML]<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>
<parent>
<artifactId>MavenParentProject</artifactId>
<groupId>de.maven.example</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>MavenEJB</artifactId>
<name>MavenEJB</name>
<description>Simple EJB for Demonstration</description>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>MavenEJBClient</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>[/XML]
MavenEJBClient
[XML]<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>
<parent>
<artifactId>MavenParentProject</artifactId>
<groupId>de.maven.example</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>MavenEJBClient</artifactId>
<name>MavenEJBClient</name>
<description>EJBClient library</description>
</project>[/XML]
MavenEnterprise
[XML]<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>
<parent>
<artifactId>MavenParentProject</artifactId>
<groupId>de.maven.example</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>MavenEnterprise</artifactId>
<packaging>ear</packaging>
<name>MavenEnterprise</name>
<description>Enterprise project ( EAR )</description>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>MavenEJBClient</artifactId>
<version>${project.version}</version>
<type>ejb-client</type>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>MavenEJB</artifactId>
<version>${project.version}</version>
<type>ejb</type>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>MavenWeb</artifactId>
<version>${project.version}</version>
<type>war</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.7</version>
<configuration>
<!-- configuration elements goes here -->
<defaultLibBundleDir>lib</defaultLibBundleDir>
<version>6</version>
<modules>
<ejbModule>
<groupId>de.maven.example</groupId>
<artifactId>MavenEJB</artifactId>
</ejbModule>
<ejbClientModule>
<groupId>de.maven.example</groupId>
<artifactId>MavenEJBClient</artifactId>
</ejbClientModule>
<webModule>
<groupId>de.maven.example</groupId>
<artifactId>MavenWeb</artifactId>
<bundleFileName>ROOT.war</bundleFileName>
</webModule>
</modules>
</configuration>
</plugin>
</plugins>
</build>
</project>[/XML]
Hier bekomme ich eine Fehlermeldung von Eclipse bei "<plugin>":
Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-ear-plugin:
2.7:generate-application-xml (execution: default-generate-application-xml, phase: generate-resources)
Kennt jemand den Hintergrund? Habe mal gehört, dass das m2e Plugin nicht ganz einwandfrei funktioniert ?! ?!
MavenWeb
[XML]<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>
<parent>
<artifactId>MavenParentProject</artifactId>
<groupId>de.maven.example</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<artifactId>MavenWeb</artifactId>
<packaging>war</packaging>
<name>MavenWeb</name>
<description>Simple Web Application</description>
</project>[/XML]
Zu Beginn habe ich innerhalb der einzelnen Module (außer Enterprise Modul) ein mvn install ausgeführt. Dies erfolgte überall fehlerfrei und fand jeweils das erzeugte Jar/War im lokalen Maven Repository.
Danach hab ich im Enterprise Modul ein mvn package ausgeführt, bekomme aber Folgenden Fehler:
Code:
mvn package -e
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building MavenEnterprise 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.250s
[INFO] Finished at: Thu Mar 22 00:09:52 CET 2012
[INFO] Final Memory: 6M/112M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project MavenEnterprise: Could not resolve dependencies for project de.maven.example:MavenEnterprise:ear:0.0.1-SNAPSHOT: Could not find artifact de.maven.example:MavenEJBClient:jar:client:0.0.1-SNAPSHOT -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project MavenEnterprise: Could not resolve dependencies for project de.maven.example:MavenEnterprise:ear:0.0.1-SNAPSHOT: Could not find artifact de.maven.example:MavenEJBClient:jar:client:0.0.1-SNAPSHOT
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:210)
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.resolveProjectDependencies(LifecycleDependencyResolver.java:117)
at org.apache.maven.lifecycle.internal.MojoExecutor.ensureDependenciesAreResolved(MojoExecutor.java:258)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:201)
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:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
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:601)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.project.DependencyResolutionException: Could not resolve dependencies for project de.maven.example:MavenEnterprise:ear:0.0.1-SNAPSHOT: Could not find artifact de.maven.example:MavenEJBClient:jar:client:0.0.1-SNAPSHOT
at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:189)
at org.apache.maven.lifecycle.internal.LifecycleDependencyResolver.getDependencies(LifecycleDependencyResolver.java:185)
... 22 more
Caused by: org.sonatype.aether.resolution.DependencyResolutionException: Could not find artifact de.maven.example:MavenEJBClient:jar:client:0.0.1-SNAPSHOT
at org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:375)
at org.apache.maven.project.DefaultProjectDependenciesResolver.resolve(DefaultProjectDependenciesResolver.java:183)
... 23 more
Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: Could not find artifact de.maven.example:MavenEJBClient:jar:client:0.0.1-SNAPSHOT
at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:538)
at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:216)
at org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:358)
... 24 more
Caused by: org.sonatype.aether.transfer.ArtifactNotFoundException: Could not find artifact de.maven.example:MavenEJBClient:jar:client:0.0.1-SNAPSHOT
at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:528)
... 26 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
Leider verstehe ich das nicht, da die MavenEJBClient.jar im lokalen Repository in der angegebenen Version abgelegt wurde - also vorhanden ist ?!
Wer kann mir helfen??? Das wäre prima.
Kann ich über das ParentProject alles auf einmal "bauen" lassen? Also nicht erst alles einzelnd (außer EAR Modul) und abschließend das EAR Modul? Ich hoffe ihr wisst was ich meine ( ist schon spät )