如何使用maven在JBoss AS 7的MANIFEST.MF中生成模块依赖关系? [英] How do you generate module dependencies in MANIFEST.MF for JBoss AS 7 with maven?
问题描述
依赖关系:< package-name>
示例:
code>依赖关系:org.slf4j
(这与Import-Package相当:适用于OSGi 。)
有关,类+加载+在+ AS7rel =noreferrer>类加载和部署的隐式模块依赖关系
项目使用Maven构建。 AS中包含的所有依赖项都被声明为提供范围。
现在问题
是否有只需使用Maven自动创建依赖关系列表的简单方法?
只有具有声明范围提供的依赖项才应该包含在内,因为所有其他内容都已包含在WAR中。 / p>
这些依赖关系是由maven工件没有任何映射的名称声明的。你可能可以保持groupId与jboss模块名称同步,但我不知道这是否是一个好主意。而我仍然无法想到任何自动化的解决方案。
但是有一个地方可以手工管理配置,如您提供的其中一个来源所述在你的问题:
< build>
...
< plugins>
< plugin>
< groupId> org.apache.maven.plugins< / groupId>
< artifactId> maven-war-plugin< / artifactId>
< configuration>
< archive>
< manifestEntries>
<依赖关系> org.slf4j< /依赖关系>
< / manifestEntries>
< / archive>
< / configuration>
< / plugin>
< / plugins>
< / build>
我希望有人想出一个插件,使其不那么麻烦。
In JBoss AS 7, a Web application that depends on libraries contained in the AS, must declare those dependencies in META-INF/MANIFEST.MF like this:
Dependencies: <package-name>
Example:
Dependencies: org.slf4j
(This is comparable to Import-Package: for OSGi.) Further information can be found in the articles about migration from older versions, class loading and implicit module dependencies for deployments
The project is built with Maven. All dependencies included in the AS are declared with scope 'provided'.
Now the question
Is there a simple way to create this list of dependencies automatically with Maven?
Only dependencies with declared scope 'provided' should be included, because all others are already included in the WAR.
Those dependencies are declared by names which maven artifacts don't have any mappings to. You probably could keep groupId in sync with jboss module names but I'm not sure if it's a good idea. And I still can't think of any automated solution.
But there is a place where you can manage the configuration by hand, as described in one of the sources you provided in your question:
<build>
...
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Dependencies>org.slf4j</Dependencies>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
I hope someone comes up with a plugin to make it less cumbersome.
这篇关于如何使用maven在JBoss AS 7的MANIFEST.MF中生成模块依赖关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!