Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to bundle additional (data) files with a Netbeans module?

I'd like to bundle some data files with the Netbeans module i'm working on. I know that i can bundle resources by adding them in a subfolder of /src so they will be packed within the jar. But i don't want the files to appear within an archive. The files should appear "loose" in a subfolder of the RCP app's directory.

Is there a way to achieve that?

Thanks in advance,

David

like image 401
dajood Avatar asked Jun 23 '12 22:06

dajood


3 Answers

NetBeans modules are packaged into .nbm files, which are essentially JAR files with some extra info in them

If you want to package something within your .nbm it must be in the /src, folder unless you're using maven then it will be /resources, but either way your resource will end up being packaged into the NBM alongside your class files

like image 177
Tim Sparg Avatar answered Sep 28 '22 08:09

Tim Sparg


If you are using maven you can configure the plugin to add addition files to the 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>

This should also give you hints for the ant solution(Which I don't know by heart).

like image 40
Christian Avatar answered Sep 28 '22 08:09

Christian


I got a solution from the NB Platform email list: I just have to create a directory called release and copy the additional files to this folder or a subdirectory. After installation of the module, these contents appear in the applications root folder.

like image 31
dajood Avatar answered Sep 28 '22 07:09

dajood