【问题标题】:Include all resources in maven project in pom.xml在 pom.xml 中包含 maven 项目中的所有资源
【发布时间】:2020-05-03 16:47:56
【问题描述】:

我需要在我的 pom.xml 中包含所有资源,但我没有成功。确实,我正在尝试这段代码,但我认为它并不适用于所有资源

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <version>2.4.1</version>
    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>shade</goal>
            </goals>
            <configuration>
                <shadedArtifactAttached>true</shadedArtifactAttached>
                <shadedClassifierName>project/classifier</shadedClassifierName>
                <outputFile>shade\${project.artifactId}.jar</outputFile>
                <transformers>
                    <transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                        <mainClass>fr.tse.fise2.pip.graphic.Main</mainClass>
                    </transformer>
                </transformers>
            </configuration>
        </execution>
    </executions>
</plugin>

【问题讨论】:

  • 我认为您需要添加更多关于您想要实现的目标以及您遇到的错误的解释。请为此编辑您的问题
  • 完成,错误是因为我需要 src/main/resources 但也需要 favicon/

标签: java eclipse maven jar pom.xml


【解决方案1】:

favicon 应位于src/main/resources 或子文件夹中。

如果您不想保留它,可以使用 maven-resources-plugin 复制它

【讨论】:

    【解决方案2】:

    我需要在名为 pip 的项目中包含我的所有资源。

    错误只是因为我在 pom.xml 中的包含不包含 src/main/resources 并且 main 无法访问此文件夹中的文件

    enter image description here

    【讨论】:

      猜你喜欢
      • 2010-09-15
      • 1970-01-01
      • 2020-08-20
      • 2018-02-18
      • 1970-01-01
      • 2013-07-07
      • 2012-06-05
      • 2023-03-04
      • 1970-01-01
      相关资源
      最近更新 更多