I use the maven assembly plug in to package my project with all its dependencies, so I can run a simple java -jar myproject.jar and be able to run the project. However, when I launched the can, they told me that
Error: Could not find or load main class com.project.ServerStart
Then I unzipped the .jar file and found that the assembly does not include my project files, which is ridiculous!
When I pack a project, I get this warning
[WARNING] Cannot include project artifact: Amjar:amjar:pom:0.2; it doesn't have an associated file or directory.
This is my config plugin
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <version>2.4</version> <configuration> <finalName>amjar-${project.version}</finalName> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> <archive> <manifest> <addClasspath>true</addClasspath> <mainClass>com.project.ServerStart</mainClass> </manifest> </archive> </configuration> <executions> <execution> <id>assemble-all</id> <phase>package</phase> <goals> <goal>single</goal> </goals> </execution> </executions> </plugin> </plugins> </build>
What am I doing wrong?
source share