简体   繁体   中英

How to build jar on windows with gradle

I'm fairly new to using external libraries with java, I'm currently trying to connect an Arduino to my windows 10 computer, and I found https://github.com/NeuronRobotics/nrjavaserial , which seems to do what I need done. The problem is I have never taken java libraries from GitHub before, so I don't know how to extract a jar file from the zip download. The readme says to use Gradle, but I don't know what that is or how to use it. Could someone please help me with this?

What is Gradle?

Gradle is an open source build automation system that builds upon the concepts of Apache Ant and Apache Maven and introduces a Groovy-based domain-specific language instead of the XML form used by Apache - Wikipedia

How to Use Gradle?

You need to install gradle command line tool from here .

Once installed gradle, follow the README of the git repository.

You also read here about gardle command line usage

Actuall you don't need Gradle to use that software.
Gradle is a build system that makes building software from source to end-result much easier and more robust.
So if you want to build their software from source, you use Gradle.

If you just want to use what they provide, you can also simply consume their built result which you can eg download from http://search.maven.org/remotecontent?filepath=com/neuronrobotics/nrjavaserial/3.13.0/nrjavaserial-3.13.0.jar , but be aware, that they in turn also have dependencies you need to include in your software, otherwise the lib will not work. Those are called transitive dependencies, dependencies your dependencies have.

If you use a proper build system like Gradle, Ant+Ivy or Maven (order from best to worst from my personal point of view) then this tool amongst other things takes care about pulling in the transitive dependencies, so you just say to the tool "my project needs com.neuronrobotics:nrjavaserial:3.13.0 " and it cares automatically to also include its transitive dependencies.

I highly recommend using Gradle for each and every tiny software, even if no external dependencies are involved. If you want to learn Gradle, start with reading its Userguide at https://docs.gradle.org/current/userguide/userguide.html .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM