3
I am having difficulty generating a Jar file from my application from Maven, I followed the following tutorial.
It comes to generate the Jar but with a super reduced size and at the time of running by CMD it presents the following message.
My Pom.xml Build is as follows:
<build>
<finalName>SisAcademia</finalName>
<plugins>
<!-- download source code in Eclipse, best practice -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>false</downloadJavadocs>
</configuration>
</plugin>
<!-- Set a compiler level -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<!-- Make this jar executable -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>br.com.tamarozzi.app.Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
Pom file session where the dependencies are:
<dependencies>
<!-- JUnit testing framework -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${springframework.version}</version>
</dependency>
<!-- Outros -->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>1.8.2.RELEASE</version>
</dependency>
<!-- Hibernate resources -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
</dependency>
<!-- Apache -->
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>20030825.184428</version>
</dependency>
<dependency>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
<version>20030825.183949</version>
</dependency>
<!-- MySQL -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
</dependency>
<!-- Log4j -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
<!-- Tiles Apache -->
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-extras</artifactId>
<version>${tiles.version}</version>
</dependency>
<!-- Miglayout -->
<dependency>
<groupId>com.miglayout</groupId>
<artifactId>miglayout</artifactId>
<version>${miglayout.version}</version>
</dependency>
<!-- JDataChooser -->
<dependency>
<groupId>com.toedter</groupId>
<artifactId>jcalendar</artifactId>
<version>1.4</version>
</dependency>
<!-- SwingX -->
<dependency>
<groupId>org.swinglabs</groupId>
<artifactId>swingx</artifactId>
<version>1.6.1</version>
</dependency>
<!-- Spring Security -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>${spring.security.version}</version>
</dependency>
</dependencies>
How are the scopes, "Scope", of your dependencies defined? I say that probably the problem is in them, they must be as "Provided", which in this case would be provided by which executes the project. Post the section of dependencies.
– Celso Marigo Jr
Celso, I’m new to Spring ] Hibernate / Maven, I just developed the project following Spring guidelines. If you can detail the problem that is occurring I will be very grateful. I added in the question what you asked me.
– Wilson Tamarozzi
See that from the tutorial item 4 that you are following, the same error occurs, that you had. Follow the tutorial item 5 that should solve your problem. As for dependencies, everything seems to be ok.
– Celso Marigo Jr
I followed your comment based on the Mkyoung tutorial and the system did not find the main, as I declare the main? the following is the image of the error:http://prntscr.com/8e12z9
– Wilson Tamarozzi