I do something similar and then package up everything as a zip file or
tar.gz with the assembly plugin.
Something like this:
<!-- this is an old project. use updated plugin versions
or better yet, pluginManagement -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.6</version>
<configuration>
<descriptor>src/main/assembly/assembly.xml</descriptor>
</configuration>
</plugin>
And the assembly.xml file (leaving out the schema for brevity):
<?xml version="1.0" encoding="UTF-8"?>
<assembly>
<id>bin</id>
<formats>
<format>tar.gz</format>
<format>zip</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<includeSiteDirectory>false</includeSiteDirectory>
<fileSets>
<fileSet>
<directory>target</directory>
<outputDirectory></outputDirectory>
<includes>
<include>*.jar</include>
<include>lib/</include>
</includes>
</fileSet>
</fileSets>
</assembly>
Then, mvn package followed by mvn assembly:single gives me a tar.gz and
a zip file containing the correct structure. I can ship that around,
unpack it, and run the program from the command line with:
java -jar ./jarname.jar
Works for me.
. . . just my two cents
/mde/
On 8/15/2020 9:07 PM, Bradley Willcott wrote:
> Hi Bayless,
>
> Are you using an Ant build or Maven? If Maven, have a look at
> "maven-jar-plugin" and "maven-dependency-plugin". Here is an example of
> both from one of my projects:
>
> <build>
> <plugins>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-jar-plugin</artifactId>
> <version>3.2.0</version>
> <configuration>
> <archive>
> <manifest>
> <addClasspath>true</addClasspath>
> <classpathPrefix>libs/</classpathPrefix> <<=== Important
> <mainClass>org.markdownj.cli.Main</mainClass>
> <addBuildEnvironmentEntries>true</addBuildEnvironmentEntries>
> <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
> </manifest>
> </archive>
> </configuration>
> </plugin>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-dependency-plugin</artifactId>
> <version>3.1.1</version>
> <executions>
> <execution>
> <id>copy-dependencies</id>
> <phase>prepare-package</phase>
> <goals>
> <goal>copy-dependencies</goal>
> </goals>
> <configuration>
> <includeScope>runtime</includeScope>
> <excludeScope>test</excludeScope>
> <outputDirectory>
> ${project.build.directory}/libs
> <<=== Important
> </outputDirectory>
> </configuration>
> </execution>
> </executions>
> </plugin>
> </plugins>
> </build>
>
> Of course, the "<<=== Important" text is not part of the POM text.
>
> All you need to do then is copy the 'libs' directory to the same
> directory you install the 'jar' file to, and then it should work a
> charm. Does for me.
>
> Brad.
>
> On 15/8/20 8:13 pm, Bayless Kirtley wrote:
>> I recently upgraded from Netbeans 8.1 to 11.1 and due to problems
>> with java 8 I also went to 11. I have been working on some existing
>> projects and everything works fine from within Netbeans. When I try to
>> deploy though, it seems that Netbeans is no longer including the lib
>> directory in the dist directory and the programs will not run. Even
>> when I just replace the jar file in the dist directory, leaving the
>> lib directory as it was, the programs still will not run. What do I
>> need to do to correct this situation?
>>
>> Bayless
>>
>>
>>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists