mashkurm mashkurm - 1 year ago 52
Git Question

Need to create Java JAR file and add it to Maven Dependency

I have a project downloaded from git. Here is the link to source code, I have downloaded it and now I am trying to create a JAR file and then want to attach it to maven repository. When I compile it using mvn compile and mvn package, it gives me the same INFO message, and in my target folder there is a jar file is created. But only pom.xml and are shown inside it, instead of whole hierarchy of compiled class files replaced with Java files

Answer Source

Maven is very picky about following a very specific folder layout in the given project (which you can override but it is not really intended to do so).

Instead you may want to just install the generated jar file directly in your local repository using the mvn install:install command.

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