Browse Source

- support for native bundles

Sebastian Stenzel 11 years ago
parent
commit
318eb24d64
1 changed files with 78 additions and 16 deletions
  1. 78 16
      oce-main/oce-ui/pom.xml

+ 78 - 16
oce-main/oce-ui/pom.xml

@@ -19,6 +19,7 @@
 
 	<properties>
 		<exec.mainClass>de.sebastianstenzel.oce.ui.MainApplication</exec.mainClass>
+		<javafx.tools.ant.jar>${java.home}/../lib/ant-javafx.jar</javafx.tools.ant.jar>
 	</properties>
 
 	<dependencies>
@@ -38,33 +39,94 @@
 
 	<build>
 		<plugins>
-
 			<plugin>
 				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-assembly-plugin</artifactId>
-				<configuration>
-					<archive>
-						<manifestEntries>
-							<JavaFX-Version>${javafx.version}</JavaFX-Version>
-							<JavaFX-Application-Class>${exec.mainClass}</JavaFX-Application-Class>
-							<Main-Class>${exec.mainClass}</Main-Class>
-						</manifestEntries>
-					</archive>
-					<descriptorRefs>
-						<descriptorRef>jar-with-dependencies</descriptorRef>
-					</descriptorRefs>
-				</configuration>
+				<artifactId>maven-dependency-plugin</artifactId>
+				<executions>
+					<execution>
+						<id>copy</id>
+						<phase>prepare-package</phase>
+						<goals>
+							<goal>copy-dependencies</goal>
+						</goals>
+						<configuration>
+							<outputDirectory>${project.build.directory}/libs</outputDirectory>
+							<includeScope>compile</includeScope>
+							<includeScope>runtime</includeScope>
+							<excludeArtifactIds>javafx</excludeArtifactIds>
+						</configuration>
+					</execution>
+				</executions>
+			</plugin>
+			<plugin>
+				<artifactId>maven-antrun-plugin</artifactId>
+				<version>1.7</version>
 				<executions>
 					<execution>
-						<id>assemble-all</id>
+						<id>native-launcher</id>
 						<phase>package</phase>
 						<goals>
-							<goal>single</goal>
+							<goal>run</goal>
 						</goals>
+						<configuration>
+							<target xmlns:fx="javafx:com.sun.javafx.tools.ant">
+								<taskdef uri="javafx:com.sun.javafx.tools.ant" resource="com/sun/javafx/tools/ant/antlib.xml" classpath="${javafx.tools.ant.jar}" />
+								<fx:application id="fxApp" name="${project.name}" mainClass="${exec.mainClass}" />
+
+								<fx:jar destfile="${project.build.directory}/${project.build.finalName}">
+									<fx:application refid="fxApp" />
+									<fx:fileset dir="${project.build.directory}/classes" />
+									<fx:resources>
+										<fx:fileset dir="${project.build.directory}" includes="libs/*.jar" />
+									</fx:resources>
+								</fx:jar>
+
+								<fx:deploy outdir="${project.build.directory}/dist" outfile="${project.build.finalName}" nativeBundles="all">
+									<fx:info title="Cloud Encryptor" vendor="cloudencryptor.org" />
+									<fx:platform basedir="" javafx="2.2+" j2se="8.0" />
+									<fx:application refid="fxApp" />
+									<fx:resources>
+										<!-- If you changed <fx:jar> above, don't forget to modify the line below -->
+										<fx:fileset dir="${project.build.directory}" includes="${project.build.finalName}.jar" />
+										<fx:fileset dir="${project.build.directory}" includes="libs/*.jar" />
+									</fx:resources>
+								</fx:deploy>
+							</target>
+						</configuration>
 					</execution>
 				</executions>
 			</plugin>
 		</plugins>
+
+		<pluginManagement>
+			<plugins>
+				<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself. -->
+				<plugin>
+					<groupId>org.eclipse.m2e</groupId>
+					<artifactId>lifecycle-mapping</artifactId>
+					<version>1.0.0</version>
+					<configuration>
+						<lifecycleMappingMetadata>
+							<pluginExecutions>
+								<pluginExecution>
+									<pluginExecutionFilter>
+										<groupId>org.apache.maven.plugins</groupId>
+										<artifactId>maven-dependency-plugin</artifactId>
+										<versionRange>[2.1,)</versionRange>
+										<goals>
+											<goal>copy-dependencies</goal>
+										</goals>
+									</pluginExecutionFilter>
+									<action>
+										<ignore></ignore>
+									</action>
+								</pluginExecution>
+							</pluginExecutions>
+						</lifecycleMappingMetadata>
+					</configuration>
+				</plugin>
+			</plugins>
+		</pluginManagement>
 	</build>
 
 </project>