Good morning,
I have a netbeans project that uses maven to build an executable jar, so that's fine. The problem is that when I run the project through ".jar" which is generated by maven, execution takes a lot longer to execute certain functions than when I run through the netbeans IDE. To get an idea, the start of the program run by Netbeans takes 8 seconds, while in the ".jar" it takes approximately 25 seconds. At the beginning I read some configuration files, and digital certificates. Other time - consuming functions, such as signing xml documents, which have been slow in the IDE for some time, last forever in the jar. Also, the strange thing is that my project has few libraries.
I also looked at other topics, I found many saying (like this here ) to generate the ".jar" with the option to extract the libraries in the generated file, but I do not really know how to do it in maven. I've even tried it in some ways, but I do not know if I'm making a mistake, or if it did not work.
I'll post my pom.xml file here to see if anyone has any idea what I can do to resolve this.
<?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>br.com.argus</groupId>
<artifactId>CronosAuxiliar</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.9.7</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20140107</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.2</version>
</dependency>
<dependency>
<groupId>br.com.samuelweb</groupId>
<artifactId>java-nfe</artifactId>
<version>3.10.8</version>
</dependency>
<!--Dependência de Log-->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>br.com.argus</groupId>
<artifactId>CronosLibNotaFiscal</artifactId>
<version>[1,)</version>
</dependency>
</dependencies>
<repositories>
<repository>
<name>Repositorio Autocom SnapShot</name>
<id>Snapshot</id>
<url>http://www.autocomsistemas.com.br:8081/nexus/content/repositories/autocom/</url>
</repository>
</repositories>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<archive>
<manifest>
<mainClass>br.com.argus.cronos.main.CronosAuxiliar</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>