This is probably a really fundamental question, but I'm afraid I don't know much about Java and I couldn't find the answer anywhere.
I'm attempting to build an Ant library which depends on the TFS SDK. I followed the guide to setting up a project, but when I export it as a JAR and try to run a task using ANT I get the following error:
java.lang.NoClassDefFoundError: /com/microsoft/tfs/core/util/TFSUser
I realise I could put the TFS SDK JAR in my ANT lib folder, but if possible I'd like my JAR to include it and the library just work without having to do so.
This answer seems to say it's possible to include all the resources needed to run using Eclipse (I'm using 3.7.2) but it doesn't detail how to actually do it. What is the option in Eclipse to do so?
java is a main starting point which has main(String args[]) method inside. pom. xml file in which we will add Maven Plugins which will build executable . jar project with all included dependancies.
Maven is one of the most used tools for Java application development. Maven packaging will create a Jar file without dependencies. Maven provides other plugins using which we can generate the jar with all its dependencies which is usually called FatJar, which is used as an executable Jar file.
The value jar-with-dependencies tells Maven to build a JAR file with dependencies which is another term for a Fat JAR. The executions XML element tells Maven which Maven build phase and goal this Maven plugin should be executed during. The maven-assembly-plugin should always be executed during the package phase.
Select "Extract required libraries into generated JAR" as you do the export.
Select "Extract required libraries into generated JAR" as you do the export.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With