How can I include test classes into Maven jar and execute them?

You should not access test classes from your application code, but rather create a main (the same main) in the test scope and create an additional artifact for your project. However, in this additional artifact (jar) you would need to have: The test classes The application code classes External dependencies required by application code (in … Read more

Maven JAR Plugin 3.0.2 Error: You have to use a classifier to attach supplemental artifacts to the project instead of replacing them

The Jar Plugin is actually getting executed twice with the configuration: <plugin> <artifactId>maven-jar-plugin</artifactId> <version>3.0.2</version> <executions> <execution> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin> If you check the logs with such a configuration, you will have something like: [INFO] — maven-jar-plugin:3.0.2:jar (default-jar) @ test — [INFO] Building jar: …\test\target\test-0.0.1-SNAPSHOT.jar [INFO] [INFO] — maven-jar-plugin:3.0.2:jar (default) @ test — … Read more

m2e error in MavenArchiver.getManifest()

I encountered the same issue after updating the maven-jar-plugin to its latest version (at the time of writing), 3.0.2. Eclipse 4.5.2 started flagging the pom.xml file with the org.apache.maven.archiver.MavenArchiver.getManifest error and a Maven > Update Project.. would not fix it. Easy solution: downgrade to 2.6 version Indeed a possible solution is to get back to … Read more

Maven: The packaging for this project did not assign a file to the build artifact

I don’t know if this is the answer or not but it might lead you in the right direction… (I believe these steps are for people working with Intellij IDE. The install:install is available in the Maven panel on the right by default. The below steps are alternative to it.) The command install:install is actually … Read more