Reputation: 29280
I've inherited a project (non-mavenized) which has a lib
folder with approx 45 .jar
's within it.
I'm fairly certain that not all of those jars are required.
Is there a way I can determine from the source of the project which jar
's really are required, and which are adding no value, and are safe to remove?
Ideally I'd like to identify the "direct" dependencies, (ie., non-transitive) so I can extract these to a pom
.
Upvotes: 2
Views: 123
Reputation: 3919
Just create the POM with direct dependencies on ALL the included JARs, then run mvn dependency:analyze
.
This should report those dependencies that are not directly accessed by your source. Then remove those ones.
Upvotes: 2
Reputation: 43
You could try setting it up as a project in an IDE like Eclipse without importing the jars and then as the IDE flags up all the compiler errors, import the relevant jar.
You should be left with the unnecessary ones unimported.
That might be a bit of a long-winded approach though, I'm afraid I don't know enough to say if there's a better way.
Upvotes: 0
Reputation: 88707
You might try and remove the jars (from the build path), then make a clean install and see whether the project compiles. If so, the removed jars should not be direct dependencies.
Upvotes: 0