将指定文件夹中的所有jar包含在ear文件中

时间:2018-10-28 11:23:21

标签: java maven jar ear

我正在尝试将旧项目迁移到Maven。 实际上,我遇到了如何将“ resources”文件夹中的所有文件复制到EAR文件的根目录中的问题。

能否请您说明在何处添加此“资源”目录的配置?

我重新设置了我可能想要使用“ earSourceDirectory”的权限

Maven文档中有关此参数的引号: “将单个文件包含在EAR中。 默认值为:$ {basedir} / src / main / application。”

这是我在“ ear”目录中的pom.xml文件:

<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
     xmlns="http://maven.apache.org/POM/4.0.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<packaging>ear</packaging>
<parent>
    <artifactId>detal</artifactId>
    <groupId>detal</groupId>
    <version>1.0</version>
</parent>
<groupId>javaee-app.ear</groupId>
<artifactId>ear</artifactId>
<version>1.0</version>
<name>ear</name>
<url>http://maven.apache.org</url>
<dependencies>
    <dependency>
        <groupId>javaee-app.controller</groupId>
        <artifactId>controller</artifactId>
        <type>ejb</type>
        <version>1.0</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>javaee-app.view</groupId>
        <artifactId>view</artifactId>
        <version>1.0</version>
        <type>war</type>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>3.8.1</version>
        <scope>test</scope>
    </dependency>
</dependencies>
<build>
    <plugins>
        <plugin>
            <artifactId>maven-ear-plugin</artifactId>
            <version>2.4.2</version>
            <configuration>
                <jboss>
                    <version>5</version>
                </jboss>
                <modules>
                    <ejbModule>
                        <groupId>javaee-app.controller</groupId>
                        <artifactId>controller</artifactId>
                    </ejbModule>
                    <webModule>
                        <groupId>javaee-app.view</groupId>
                        <artifactId>view</artifactId>
                        <contextRoot>view</contextRoot>                            
                    </webModule>
                    <jarModule>
                        <groupId>javaee-app.model</groupId>
                        <artifactId>model</artifactId>
                        <includeInApplicationXml>true</includeInApplicationXml>
                    </jarModule>
                    <jarModule>
                        <groupId>javaee-app.utils</groupId>
                        <artifactId>utils</artifactId>
                        <includeInApplicationXml>true</includeInApplicationXml>
                    </jarModule>
                </modules>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-resources-plugin</artifactId>
            <version>2.2</version>
            <configuration>
                <encoding>UTF-8</encoding>
            </configuration>
        </plugin>
    </plugins>
</build>

0 个答案:

没有答案