Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ezhov-da/4c88f83ea96c7e9e74fe30b0f4a423d7 to your computer and use it in GitHub Desktop.
Save ezhov-da/4c88f83ea96c7e9e74fe30b0f4a423d7 to your computer and use it in GitHub Desktop.
java maven сборка проекта с библиотеками в один jar
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<mainClass>ru.ezhov.plannedsalescalculation.MainApp</mainClass>
<!--<mainClass>ru.ezhov.plannedsalescalculation.views.DialogShowLogTest</mainClass>-->
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<version.file>config.properties</version.file>
<app.const.version.file>app.version</app.const.version.file>
<name.zip>${project.artifactId}_${project.version}.zip</name.zip>
<folder.application.dist>dist</folder.application.dist>
<full.name.jar.with.version>${project.artifactId}-${project.version}.${project.packaging}</full.name.jar.with.version>
<full.name.jar.without.version>${project.artifactId}.${project.packaging}</full.name.jar.without.version>
</properties>
<build>
<finalName>planned_sales_calculation</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>unpack-dependencies</id>
<phase>package</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<excludeScope>system</excludeScope>
<excludeGroupIds>junit,org.mockito,org.hamcrest</excludeGroupIds>
<outputDirectory>${project.build.directory}/classes</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>unpack-dependencies</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${java.home}/../bin/javapackager</executable>
<arguments>
<argument>-createjar</argument>
<argument>-nocss2bin</argument>
<argument>-appclass</argument>
<argument>${mainClass}</argument>
<argument>-srcdir</argument>
<argument>${project.build.directory}/classes</argument>
<argument>-outdir</argument>
<argument>${project.build.directory}</argument>
<argument>-outfile</argument>
<argument>${project.build.finalName}.jar</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>default-cli</id>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${java.home}/bin/java</executable>
<commandlineArgs>${runfx.args}</commandlineArgs>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<compilerArguments>
<bootclasspath>${sun.boot.class.path}${path.separator}${java.home}/lib/jfxrt.jar</bootclasspath>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.16</version>
<configuration>
<additionalClasspathElements>
<additionalClasspathElement>${java.home}/lib/jfxrt.jar</additionalClasspathElement>
</additionalClasspathElements>
</configuration>
</plugin>
</plugins>
</build>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment