Use Eclipse+maven to compile Jedis source into jar package and source jar package

Source: Internet
Author: User

On GitHub, there are a lot of source code that are MAVEN projects, but many do not have jar packages. To find the words on the Internet the first is more difficult, the second is afraid not enough original. With Maven+eclipse, we can visualize the build of the MAVEN project into the jar library package and the source jar package.

1. Download maven

:http://maven.apache.org/download.html


2, unzip to Local:


3, configuring environment variables

3-1, configure the Java-home variable first.

Create a new system variable and write the Java-home value.


Add%java_home%\bin;%java_home%\jre\bin;d:\apache-maven-3.2.5\bin to the path of the system variable;


3-2 Configuring MAVEN System variables:

In the path of the system variable, add the Bin directory under Maven decompression directory: D:\apache-maven-3.2.5\bin;


Note Each in English half-width symbol;

4, test if MAVEN is installed successfully.

Enter Mvn-v in cmd, if the print is good, it will be successful.


Optional configuration:

To modify MAVEN's repository directory, using MAVEN, some online libraries may be used, and Maven will download to the Repository directory first. We create a new repository folder in the Maven directory, such as one of the above images. Then, under the Conf directory under the MAVEN directory, there is a settings.xml file that we can configure for this repository property:


It is not clear why the catalogue is to be made.

5, install Maven's eclipse plugin

There are two general Eclipse installation plug-ins, one for online installation and one for offline installation. The online installation of Maven's address is always changing, so it's not reliable. Choose offline installation, offline package:

Http://www.cr173.com/soft/66582.html (pro-Test), extract to Eclipse's dropins file after download


Open Eclipse, Menu windows-preference, enter maven in the upper left input box, if the corresponding menu is installed the plugin succeeds:


To configure the parameters for Maven in eclipse:



If we had just modified the repository directory, it would have been shown in the circle.

6, download the Jedis project on GitHub:

Address: Https://github.com/xetorthio/jedis

Select the latest releases version:






Click "Download ZIP" to download.

7, import into eclipse

Unzip after download, open Eclipse, right-click Package explorer-import-maven4myeclipse-exiting Maven Projects After importing the extracted Maven project (the obvious sign of MAVEN project is the Pom.xml file)


Delete the test package. The Src/test package is just a few examples and does not actually work for packaging a jar library. I can't see the bird because I have deleted it.



8. Modify the configuration file and generate jar and source jar packages

Modify the Pom.xml file.


Why delete it, because the package name after packaging is for the <name> field +<version> field +[sources]+jar. So delete the <version>-snapshot text just for a little look. Yes, I'm just so proud. -snapshot is: There are two warehouses in maven, snapshot snapshot warehouse and release publishing warehouse. The snapshot snapshot repository is used to save the unstable version of the development process, and the release formal repository is used to store stable releases.

Start Packing: Right-click Project, run As-maven build, go to runtime Configuration interface:

Enter in goals: Clean Source:jar The package, then click the "Run" button to run.


Command parsing:

Clean: Clears all files under target under the project

Source:jar: Generate the Source jar file

Package: Build a compiled jar library

At this point, we have generated two jar files in target, which can be referenced. With the sources typeface is the source of the jar file, the other jar is a well-compiled jar library.


Use Eclipse+maven to compile Jedis source into jar package and source jar package

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.