java java
java java

Reputation: 415

How to convert a maven dependeny from the local repo to a maven project in eclipse ?

I have a local Maven Repository (.m2) where I have dependencies. I want to import for example one dependency as a maven project to eclipse. The dependency contains of course the .java files.

So my repo structure is: 
com
   |_____logging
               |____logging-0.0.1.jar ( with java files)
               |____logging-0.0.1.pom

1) The logging-0.0.1.jar has no pom.xml inside. I think it is a maven standard
to put the pom in the same level as the jar.
2) Now I want to import the logging folder as a maven project into eclipse. I want to see the java files and do edits an so on.

Is there a good way to do this ?

Upvotes: 2

Views: 528

Answers (2)

RITZ XAVI
RITZ XAVI

Reputation: 3789

All you need to do is to follow the standard maven folder structure. You can extract the jar that has the java files to some location. Then create a folder structure like src/main/java and then put the source code( including the same package structure that you got after extracting) in this folder. It should look something like src/main/java/com/apache/logging/..../*.java. Also place the pom.xml at the root level. Now in Eclipse, import it as an existing maven project (File -> Import -> Existing Maven Project) and browse for the pom.xml. You should be good to go then.

Upvotes: 1

Balázs Nemes
Balázs Nemes

Reputation: 729

How did you created the pom.xml for that logging jar? Did you generated a standard java pom.xml?

You need to know everything about the logging project to generate its pom file. What dependencies it needs what plugins it uses ...etc. Basically reverse engineering the maven project from a jar artifact does not work. If you need the source project you have to obtain it from the author somehow.

Upvotes: 0

Related Questions