15
Is it necessary to make some extra configuration to generate a Maven executable . jar? How have I never used this technology under development desktop I’m a little lost.
When I build the project (the logs show that you built successfully) and try to run it, nothing happens. To see if there was an exception or something similar, I tried to execute by command line and here’s the message:
Unable to locate or load main class
My file pom.xml
is like 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>kitty.project</groupId>
<artifactId>Kitty</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<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>
<name>Kitty</name>
<dependencies>
<!-- Dependências do projeto -->
</dependencies>
</project>
Is any configuration missing? How can I fix this and generate one .jar
executable as if it were a normal Java application?
It worked, even complaining about the lack of
<version>
. Can some configuration be made in this plugin to generate a single . jar with everything packaged? Because it was generated several directories besides the "executable".– Renan Gomes
It’s forgotten about the <version>. As for the other directories files created this is normal. If you are versioning your project just configure your scm to ignore the target folder. In my case, how I use Git I create a file called ". gitignore" and inside it I put (among other things I want Git to ignore), the folder name "target".
– Alexandre