您如何使用 maven 在 MANIFEST.MF 中为 JBoss AS 7 生成模块依赖项? [英] How do you generate module dependencies in MANIFEST.MF for JBoss AS 7 with maven?

查看:22
本文介绍了您如何使用 maven 在 MANIFEST.MF 中为 JBoss AS 7 生成模块依赖项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 JBoss AS 7 中,依赖于 AS 中包含的库的 Web 应用程序必须像这样在 META-INF/MANIFEST.MF 中声明这些依赖项:

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>

示例:

Dependencies: org.slf4j

(这相当于 Import-Package: for OSGi.)更多信息可以在关于 从旧版本迁移类加载部署的隐式模块依赖

(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

项目是用Maven构建的.包含在 AS 中的所有依赖项都声明为范围提供".

The project is built with Maven. All dependencies included in the AS are declared with scope 'provided'.

是否有一种简单的方法可以使用 Maven 自动创建此依赖项列表?

Is there a simple way to create this list of dependencies automatically with Maven?

仅应包含声明范围为provided"的依赖项,因为所有其他依赖项都已包含在 WAR 中.

Only dependencies with declared scope 'provided' should be included, because all others are already included in the WAR.

推荐答案

这些依赖项是由 Maven 工件没有任何映射的名称声明的.您可能可以将 groupId 与 jboss 模块名称保持同步,但我不确定这是否是个好主意.而且我仍然想不出任何自动化的解决方案.

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 在 MANIFEST.MF 中为 JBoss AS 7 生成模块依赖项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆