在编译以下 pom 时,我收到一个异常,指出core
项目中缺少依赖项:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-ear-plugin:2.8:generate-application-xml (default-generate-application-xml) on project theear: Artifact[ejb:com.myapp:core] is not a dependency of the project. -> [Help 1]
theear 的设置如下:
<project ...>
...
<artifactId>theear</artifactId>
<packaging>ear</packaging>
<dependencies>
<dependency>
<groupId>com.myapp</groupId>
<artifactId>web</artifactId>
<version>${application.web.version}</version>
<type>war</type>
<scope>runtime</scope>
</dependency>
<!-- myapp projects -->
<dependency>
<groupId>com.myapp</groupId>
<artifactId>core</artifactId>
</dependency>
...
</dependencies>
<build>
<finalName>theear</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.8</version>
<configuration>
<modules>
<webModule>
<groupId>com.myapp</groupId>
<artifactId>web</artifactId>
<contextRoot>/web</contextRoot>
<bundleFileName>web.war</bundleFileName>
</webModule>
<ejbModule>
<groupId>com.myapp</groupId>
<artifactId>core</artifactId>
<bundleFileName>core.jar</bundleFileName>
</ejbModule>
</modules>
<defaultLibBundleDir>lib/</defaultLibBundleDir>
<skinnyWars>true</skinnyWars>
</configuration>
</plugin>
...
</plugins>
</build>
</project>
核心项目是这样的:
<project ...>
<modelVersion>4.0.0</modelVersion>
<artifactId>core</artifactId>
<version>1.0.0.Pre-Alpha</version>
<packaging>ejb</packaging>
<dependencies>
...
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
<version>2.3</version>
<configuration>
<ejbVersion>3.1</ejbVersion>
</configuration>
</plugin>
</plugins>
</build>
</project>
如您所见,ear 清楚地将核心模块列为依赖项
注意:版本丢失,因为这个 pom 声明了一个聚合 pom 作为它的父级,并带有相应的 dependencyManagement 标签。
知道这可能是什么原因吗?