eclipse - Java, create runnable jar file including ONLY used dependencies. -
This question has been asked before, but there is no satisfactory answer yet!
I have Java class in a project full of other non-affiliated sections in Java Maa. I want to export a Java executable to a jar file, in which it uses only dependencies.
Is it possible, if so how?
Both Eclipse (Create Runner Jar) and Intelligence (Artifact) will include all the dependencies defined in the menu with Java class.
Instead of the people you provided in eclipses and IDEA by default, a dependency management system Should use. Many Java developers use (including me) if you are working in Eclipse, then it includes
You do not want to have all dependencies in a project because it can actually be bloated though , If you have a Maven original pom
which is & lt; Dependency Management & gt;
tag, you can easily simply refer to this parent pom
and then easily reference only the context of the dependency in that sub project, all this is different Which is really different, and provides an easy organization system - the reason is why people use Maven.
Maven also has plugins that manage your jar for you, e.g. maven-assembly-plugin
from which you can build your dependencies so much that you want them in jars and even further.
You have to do it in any way, what you expect to do with any IDE / dependency management system with the following code:
Test.java
public class test {public static zero main (string ... args) {System.exit (0); New foo (empty); }}
Foo.java
import com.google.common.base.Preconditions; Public class fu {public fu (strings) {precondition. Czech Noble (S); }}
No dependency required ... but you only know that in RUNTIME. If you include all the import statements of all sections, then you include all the dependencies. If you do not, then you have to do runtime analysis. Your problem is similar.
Comments
Post a Comment