简体   繁体   English

.dat文件未打包在Netbeans的jar中

[英].dat files not packaged in jar in Netbeans

I have a maven Java project projA that build into a jar. 我有一个内置在jar中的Maven Java项目projA。 I have another maven Web project projB that holds a dependency of projA. 我有另一个Maven Web项目projB,其中包含projA的依赖项。

In proj A one of my classes accesses the resources located in the packages in projA. 在projA中,我的一个班级访问了projA包中的资源。

When I expand the jar shown under dependencies in projB, I see that it does not contain the resource files (.dat). 当我在projB中的依赖关系下显示jar时,我看到它不包含资源文件(.dat)。

What setting I need to do to copy these files into the jar when I build my projA in Netbeans 在Netbeans中构建projA时需要执行哪些设置以将这些文件复制到jar中

I am using NetBeans IDE 8.0.2 / Java 1.8 我正在使用NetBeans IDE 8.0.2 / Java 1.8

In your pom.xml, include something along the line like this: 在您的pom.xml中,添加如下内容:

<build>
    <resources>
        <resource>
            <filtering>false</filtering>
            <directory>src/main/java</directory>
            <includes>
                <include>**/*.dat</include>
            </includes>
            <excludes>
                <exclude>**/*.java</exclude>
            </excludes>
        </resource>
    </resources>
[...]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM