【发布时间】:2016-12-20 11:39:08
【问题描述】:
我有 maven jar 文件,它作为依赖项包含在 maven ejb 中。下面解释所有项目结构:
1) 父级 (reports-service) 的 pom.xml :
<groupId>com.xxx.pdf.reports</groupId>
<artifactId>reports-parent</artifactId>
<version>2.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Reports - Parent</name>
<modules>
<module>reports-application</module>
<module>reports-service</module>
</modules>
2) pom.xml of ear(reports-application) :
<parent>
<groupId>com.xxx.pdf.reports</groupId>
<artifactId>reports-parent</artifactId>
<version>2.0.0-SNAPSHOT</version>
</parent>
<artifactId>reports-application</artifactId>
<packaging>ear</packaging>
<dependencies>
<dependency>
<groupId>com.xxx.pdf.reports</groupId>
<artifactId>reports-service</artifactId>
<version>${project.version}</version>
<type>ejb</type>
</dependency>
</dependencies>
3) pom.xml of ejb(reports-service) :
<parent>
<groupId>com.xxx.pdf.reports</groupId>
<artifactId>reports-parent</artifactId>
<version>2.0.0-SNAPSHOT</version>
</parent>
<artifactId>reports-service</artifactId>
<packaging>ejb</packaging>
<dependencies>
<dependency>
<groupId>com.xxx.common.serviceframework</groupId>
<artifactId>ServiceFramework</artifactId>
<version>1.1.0-SNAPSHOT</version>
</dependency>
.......other dependencies..........
................
4) pom.xml of jar(ServiceFramework) :
<groupId>com.xxx.common.serviceframework</groupId>
<artifactId>ServiceFramework</artifactId>
<version>1.0.0-SNAPSHOT</version>
如上所述,reports-service 是构建报表应用程序和报表服务的父 pom。这两者都是它的模块。
reports-application 只是一个包含reports-service(ejb) 的耳朵。
reports-service 包含 ServiceFramework(jar) 作为其依赖项。此 ServiceFramework 包含连接到数据库以保存信息的代码。现在这个 ServiceFramework 可以包含在任何 ebj 中(我的项目中有很多这样的),比如报告服务来保存信息。
现在,我想从 ServiceFramework 中的 java 代码获取报告服务的版本(以及一些其他 pom.xml 信息,如 groupId && artifactId)。我尝试使用 Maven 资源插件。
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
但它给了我 ServiceFramework 的版本,因为选择版本的 java 代码在 ServiceFramework jar 中。我想要使用 ServiceFramework jar 的应用程序版本。我尝试了所有方法,但所有方法都为我提供了 ServiceFramework 版本。
要求 ServiceFramework 应该能够获取包含它作为其依赖项的 ejb 的 pom 信息。那么,如何从 ServiceFramework 获取/读取报告服务的 pom 信息?
【问题讨论】:
标签: spring maven maven-plugin