How do I create a desktop (standalone/Swing) application with Maven?
I'm using Eclipse 3.6.
The following example is a stand-alone Java™ API program. This program can be compiled and can be run as a stand-alone program from command prompt or from within an IDE like Rational® Software Architect.
Spring Boot makes it easy to create stand-alone, production-grade Spring-based applications. Spring Boot provides various starters for building standalone or more traditional war deployments.
To build a Maven project via the command line, you use the mvn command from the command line. The command must be executed in the directory which contains the relevant pom file. You pass the build life cycle, phase or goal as parameter to this command.
There's no easy way to simulate what Maven does without Maven. If you absolutely can't install maven on the server, build your artifacts on another server (or locally) and move them onto the server via scp.
Create a Maven project as follows:
mvn archetype:generate -DgroupId=com.yourapp.app
-DartifactId=swingapp
-Dversion=1.0-SNAPSHOT
Add the following entry to your pom file:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<archive>
<manifest>
<mainClass>com.yourapp.app.YourMainClass</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
Import the project into Eclipse as a Maven project, then run as Java application.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With