How can I use a src folder library from GitHub - java

I am trying to use this library from github.
They only provide a src folder and there is no compiled JAR that I can use.
My question is, How can I use the library in my Java project in the Eclipse IDE?
I've tried researching but I can't find a single website that doesn't assume I know how to use these types of libraries. It must be something obvious that I'm missing. It would be great if someone could point me in the right direction.

Clone the project with git, then make a build yourself, there is an included pom.xml file for maven
UPDATE
link from maven central

It's a Maven project. You will have to build it using Maven and then import the build jar from ~/.m2/repository or target directory in your Eclipse project classpath.

Related

How can we convert an existing java project with lib folder to Maven?

I have a old java project that does not use Maven or any other build tool. All the Dependencies/external jars that I need to run my project are located in a "libs" folder in my root directory. Now, i want to completely "mavenize' my project and discard the library folder.
I dont want to find all dependencies from mvn central repository and copy in the pom.xml. I have read some answers which use the install:install-file but i dont understand clearly.
Is there any fast way in which i can run my project using maven and get rid of the lib folder completely from my project?
Kindly help as im a newbie in Maven.
lib folder in java project
The way to go is what you don't want to do.
You need to look up all the dependencies on MavenCentral and copy the XML to the POM.

Generate sources from a local jar file in Maven

I have a locally stored jar file that I believe I need to generate the sources in order to consume it in my project.
I am using JDK 8, IntelliJ and Maven 3.5.2
I have installed the jar file into my local .m2 folder.
Perhaps I am missing a goal in my maven lifecycle or a plugin?
Not had to use a local jar dependency before so any help appreciated (I'm a tester not a developer)
I've attached a screenshot (apologies for all the obfuscation of package names that I feel might be commercially sensitive - possibly overkill!)
Note the red underlining in the src test....folders where the classes cannot access those within the jar dependency.
I have added the dependency within the pom.xml file also and it shows no errors.
I feel I should have run something like -Dsources=target/mycool-project-3.0.17-SNAPSHOT-sources.jar when using the mvn install:install-file command (which I used originally when installing to my .m2. However I tried this with no success.
Or maybe I need to mark the resources as a root within IntelliJ
Currently in Project Structure -> Libraries I see:

Use Maven Library without Drinking Maven Koolaid

I want to use the diffplug/Durian library, but do not want to use Maven. Is there a way to use a Maven library without using Maven itself in a project?
This has a link to the .jar and lists it's dependencies.
http://mvnrepository.com/artifact/com.diffplug.durian/durian/3.4.0
Download the jar - then all the jar's dependencies and their dependencies and add them to the class path.
I found that IntelliJ IDEA allows for exporting of a Maven module to a JAR, that can be used in non-Maven projects.
https://www.jetbrains.com/help/idea/2016.1/downloading-libraries-from-maven-repositories.html
And needed to know what a "Maven Coordinate" was. I found it for the library in question at https://mvnrepository.com/artifact/com.diffplug.durian/durian/3.4.0, and it is the string "com.diffplug.durian:durian:3.4.0".
Basically, follow Project Structure->Project Settings->Libraries->"+"->New Project Library->From Maven. The resultant dialog takes a Maven coordinate, and has a "Download To" option, that will make a nice JAR at the specified location, from the Maven library you import. Can add source and javadocs as well. After doing the download, you navigate to the system folder containing the new JAR, and stick it in your real non-Maven project (an Eclipse project, in my case).

How to reference a java project in an eclipse maven project?

I have two java projects in eclipse. One is maven enabled, the another one is just a normal java project. I want my maven project to reference the java project on build path.
My question is, Any simple way to reference the java project without changing it to a maven project ?
Firstly, i know that i can export the project as a jar and then maven install it. Then i can reference it in the dependency section of pom.xml. This is not dynamic enough to suit my needs.
Is there a maven plugin that can help me. Thanks in advance.
You can use the answer here (https://stackoverflow.com/a/22300875) to "import" the JARs, and the link (Maven compile with multiple src directories) for the source. That way the project will remain pure Maven. Let me know if Eclipse has some issue with this solution.

why I can use the sources or jar downloaded in my project?

I am trying to use Maven and JDeveloper for a week now and I'm always get stuck with the same problem. I can download and install the extensions and create new Maven projects. When I package or compile them I can see that the sources are being downloaded and added to my local repository but they are not added in my .jar and I cannot use them in my project unless I add them as lib manually in my project.
If I try to add the folder (where the downloaded jars are) as lib folder to project they are only added as jar and I cannot use them.
Is there another way to update my dependencies from JDeveloper? How can I integrate them properly to my project so I can use them? Is there a newer Hands-On maybe solving my problems? What am I doing wrong? Is there a template project to download maybe? I hope I could explain my problem good enough...

Categories