You need to create a Java JAR file and add it to the Maven Dependency

I have a project downloaded from git. Here is the link to the source code https://github.com/dwdyer/reportng , I downloaded it, and now I'm trying to create a JAR file, and then I want to attach it to the maven repository. When I compile it with mvn compile and mvn package, it gives me the same INFO message and a jar file is created in my target folder. But inside it only pom.xml and pom.properties are displayed, and not a whole hierarchy of compiled class files replaced by Java files

+4
source share
3 answers

Maven is very picky, following the very specific location of the folders in this project (which you can override, but it’s not really intended for this).

Instead, you can simply install the generated jar file directly into the local repository using the command mvn install:install.

If you want to use a script, see Multiple install: install-file in one pom.xml for instructions on how to create pom.xml this.

+1
source

First of all, you need to debug the problem:

cd reportng/
mvn -e clean install

-eenable error tracing. If everything is in order, it installwill only add the created jarjar file to your local repository .

Then it will be available as a dependency on any project:

<dependency>
    <groupId>org.uncommons</groupId>
    <artifactId>reportng</artifactId>
    <version>1.1.4</version>
</dependency>

By the way:

Jar maven central, , , .

0

This can be resolved by changing the strusture Maven. Maven should contain src / main / java, whereas in the program it is src / java / main

0
source

Source: https://habr.com/ru/post/1651250/


All Articles