How to include .class files from dependency project maven?

566 Views Asked by At

I have two maven projects:

  1. This is the framework project and has the dependency classes in the src/main/java
  2. This is the project that contains my test scripts in the src/test/java

I want to build a jar where both the class files are included from the project in the 2nd project's pom.xml file.

What type of plugin can do the job? I have tried using maven jar plugin and assembly plugin but neither of them solved my problem.

1

There are 1 best solutions below

0
On

Both your tests and your main classes should be included in the same project, not separately. A test suite should not be a separate "module" that is imported as a dependency via pom.xml. Just as @J Fabian Meier pointed out - the tests are not included in your output file when compiled - they are just there to be ran while building to test your classes.

It's very unclear what you're trying to achieve. You might want to go through how a standard Maven project directory layout should look like.