6

我想将一些数据文件与我正在处理的 Netbeans 模块捆绑在一起。我知道我可以通过将资源添加到子文件夹中来捆绑资源,/src以便将它们打包在 jar 中。但我不希望文件出现在档案中。这些文件应该在 RCP 应用程序目录的子文件夹中显示为“松散”。

有没有办法做到这一点?

提前致谢,

大卫

4

3 回答 3

4

NetBeans 模块被打包成 .nbm 文件,这些文件本质上是 JAR 文件,其中包含一些额外的信息

如果你想在你的 .nbm 中打包一些东西,它必须在/src, 文件夹中,除非你使用的是 maven,否则它将是/resources,但无论哪种方式,你的资源最终都会与你的类文件一起打包到 NBM 中

于 2012-06-24T12:53:53.827 回答
4

如果您使用的是 maven,您可以配置插件以将附加文件添加到nbm.

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>nbm-maven-plugin</artifactId>
    <extensions>true</extensions>
    <configuration>
        <nbmResources>
            <nbmResource>
                <directory>release/test</directory>    <!-- This is the sourcedir -->
                <targetPath>modules/test</targetPath>  <!-- This is the path relative to the installed module -->
                <includes>
                    <include>**/*.*</include>          <!-- Pattern of files to include -->
                </includes>
            </nbmResource>
        </nbmResources>
    </configuration>
</plugin>

这也应该为您提供蚂蚁解决方案的提示(我不知道)。

于 2012-06-24T18:28:28.613 回答
4

我从 NB Platform 电子邮件列表中得到了一个解决方案:我只需要创建一个名为的目录release并将附加文件复制到此文件夹或子目录中。安装模块后,这些内容会出现在应用程序根文件夹中。

于 2012-06-24T23:22:12.133 回答