i using maven in netbeans.
i noticed when run project, took me long because maven unpacking libraries.
is there way in maven unpack libraries once?
here pom.xml
<?xml version="1.0" encoding="utf-8"?> <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <groupid>com.mycompany</groupid> <artifactid>mvcfxv1</artifactid> <version>1.0-snapshot</version> <packaging>jar</packaging> <name>mvcfxv1</name> <description>a simple version of javafx setup described @ http://www.oracle.com/technetwork/articles/java/enterprisefxpt3-1735081.html</description> <properties> <project.build.sourceencoding>utf-8</project.build.sourceencoding> <mainclass>org.shinobi.testapp.main.main</mainclass> </properties> <organization> <!-- used 'vendor' jnlp generation --> <name>shinobi</name> </organization> <build> <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/javafxpackager</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.7</source> <target>1.7</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> <dependencies> <!-- miglayout --> <dependency> <groupid>com.miglayout</groupid> <artifactid>miglayout-javafx</artifactid> <version>4.2</version> </dependency> <!-- apache commons --> <dependency> <groupid>commons-lang</groupid> <artifactid>commons-lang</artifactid> <version>2.6</version> </dependency> <!-- spring framework --> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-context</artifactid> <version>4.1.6.release</version> </dependency> <!-- dom4j --> <dependency> <groupid>dom4j</groupid> <artifactid>dom4j</artifactid> <version>1.6.1</version> <type>jar</type> </dependency> <!-- jaxen --> <dependency> <groupid>jaxen</groupid> <artifactid>jaxen</artifactid> <version>1.1.6</version> </dependency> <!-- hibernate framework --> <dependency> <groupid>org.hibernate</groupid> <artifactid>hibernate-core</artifactid> <version>4.3.5.final</version> </dependency> <dependency> <groupid>org.hibernate</groupid> <artifactid>hibernate-validator</artifactid> <version>4.2.0.final</version> </dependency> <dependency> <groupid>org.hibernate.common</groupid> <artifactid>hibernate-commons-annotations</artifactid> <version>4.0.1.final</version> <classifier>tests</classifier> </dependency> <dependency> <groupid>org.hibernate.javax.persistence</groupid> <artifactid>hibernate-jpa-2.0-api</artifactid> <version>1.0.1.final</version> </dependency> <dependency> <groupid>org.hibernate</groupid> <artifactid>hibernate-entitymanager</artifactid> <version>4.0.1.final</version> </dependency> <dependency> <groupid>javax.validation</groupid> <artifactid>validation-api</artifactid> <version>1.0.0.ga</version> <scope>provided</scope> </dependency> <dependency> <groupid>org.slf4j</groupid> <artifactid>slf4j-api</artifactid> <version>1.6.4</version> </dependency> <dependency> <groupid>org.jboss.logging</groupid> <artifactid>jboss-logging</artifactid> <version>3.1.0.cr2</version> </dependency> <dependency> <groupid>org.slf4j</groupid> <artifactid>slf4j-log4j12</artifactid> <version>1.6.4</version> </dependency> <dependency> <groupid>mysql</groupid> <artifactid>mysql-connector-java</artifactid> <version>5.1.10</version> </dependency> </dependencies>
thanks!
while running application, exec-maven-plugin calling java program executable @ ${java.home}/../bin/javafxpackager location. may program unpacking libraries. if don't want unpacking libraries, can comment plugin start from
<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/javafxpackager</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>
or
handle logic inside program.
Comments
Post a Comment