有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java为什么maven ear插件不包含我放在src/main/resources中的文件?

我有一个非常简单的pom:

<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>
    <groupId>com.sandbox</groupId>
    <name>Sandbox</name>
    <artifactId>Sandbox</artifactId>
    <version>7.0</version>
    <packaging>ear</packaging>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        ...

    </dependencies>

</project>

当包装被标记为“jar”时,它将在src/main/resources处获取所有资源。但是,如果包装被标记为“ear”,它就不会在包装中获得任何这些资源。我之所以想这样做是因为我想要一个玻璃鱼资源。xml文件位于我的ear的META-INF目录中This is a valid place to put the file.


共 (0) 个答案