Maven ушной плагин и ejbModule с классификатором
В моем maven2
мультимодульный проект у меня есть 2 модуля
- один с ejb3
- один на ухо
EJB содержит зависимости, которые я хочу включить в банку.
Так что для ejb
мой pom.xml
является
<?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>
<parent>
<groupId>be.tuto</groupId>
<artifactId>cendo2015</artifactId>
<version>1.0</version>
</parent>
<artifactId>cendo2015-ejb</artifactId>
<packaging>ejb</packaging>
<name>${project.artifactId}</name>
<dependencies>
<dependency>
<groupId>be.tuto</groupId>
<artifactId>test2015</artifactId>
<type>jar</type>
<version>1.0</version>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<ejbVersion>3.0</ejbVersion>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>create-my-bundle</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Две банки хорошо сгенерированы
[INFO] [install:install {execution: default-install}]
[INFO] Installing ...\cendo2015\modules\ejb\target\cendo2015-ejb-1.0.jar to ...\.m2\repository\be\tuto\cendo2015-ejb\1.0\cendo2015-ejb-1.0.jar
[INFO] Installing ...\cendo2015\modules\ejb\target\cendo2015-ejb-1.0-jar-with-dependencies.jar to ...\.m2\repository\be\tuto\cendo2015-ejb\1.0\cendo2015-ejb-1.0-jar-with-dependencies.jar
Теперь я хочу включить в ухо банку с зависимостями.
Так что мой ear
pom.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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>be.tuto</groupId>
<artifactId>cendo2015</artifactId>
<version>1.0</version>
</parent>
<artifactId>cendo2015-app</artifactId>
<name>${project.artifactId}</name>
<packaging>ear</packaging>
<dependencies>
<dependency>
<groupId>be.tuto</groupId>
<artifactId>cendo2015-ejb</artifactId>
<type>ejb</type>
<version>1.0</version>
<classifier>jar-with-dependencies</classifier>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.10.1</version>
<configuration>
<modules>
<ejbModule>
<groupId>be.tuto</groupId>
<artifactId>cendo2015-ejb</artifactId>
<classifier>jar-with-dependencies</classifier>
</ejbModule>
</modules>
</configuration>
</plugin>
</plugins>
</build>
И наконец, мой parent
pom.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>be.tuto</groupId>
<artifactId>cendo2015</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<name>cendo2015</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</build>
<dependencyManagement>
<dependencies>
</dependencies>
</dependencyManagement>
<modules>
<module>modules/ejb</module>
<module>modules/app</module>
</modules>
Бег mvn clean package
дает мне
[INFO] [ear:generate-application-xml {execution: default-generate-application-xml}]
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Artifact[ejb:be.tuto:cendo2015-ejb:jar-with-dependencies] is not a dependency of the project.
Теперь, если я сделаю mvn clean package
работает только для ушного модуля.
[INFO] [ear:ear {execution: default-ear}]
[INFO] Copying artifact [ejb:be.tuto:cendo2015-ejb:jar-with-dependencies:1.0] to [cendo2015-ejb-1.0-jar-with-dependencies.jar]
Поэтому я не понимаю, что происходит!