2017/1/7 Learning notes jar package, maven

Source: Internet
Author: User

① about Tar,jar,war File

Tar is another common packaging format that is convenient for deployment to the Server.

The jar is Java App Server recognized Java deployment format, in fact, is a zip file, only the internal files have Specifications.

The war is a jar dedicated to Web Apps. There is also an ear suffix for enterprise apps.

② What is maven?

MAVEN is a tool for building projects that easily manage the life cycle of your project. That is, the Project's jar package relies on, develops, tests, releases Packaging.

Using MAVEN does not require a separate download of the jar package on the internet, you can automatically download the jar package to our project by configuring the dependency of the jar package in configuration file Pom.xml.

MAVEN tags for ③ projects

<groupId>com.test</groupId>
<artifactId>maventest</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>maventest</name>
<url>http://maven.apache.org</url>

GroupId: the project name, since some items are not made of a jar package, but consist of a lot of jar Packages. So this groupid is the name of the whole project.

Artifactid: the name of the Package.

Version: Revision Number.

Packaging: the type of package, usually a jar, or a war. If not, the default is the Jar.

Name and the url, one is the names and one is the address of Maven. The main is the above several parameters.

④-dependent maven Tags

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>

It is important to note that the jar package naming rules: artifactid-version[-classifier].packaging

Engineering of ⑤maven

Pom.xml: a dependency used to define or add a jar package

Src-main: for storing Java source files

Src-test: for storing test cases

Target: This is the jar package used to generate the corresponding class file or release

⑥eclipse common commands in Maven

  maven build: This command compiles the MAVEN project and executes the command to generate the corresponding class file in the classes in the target Folder.

Maven clean: Delete the target folder, which deletes the generated package packages and files such as class.

Maven Test: compile automatically before running all of the test cases.

Maven Install: Publish the package that corresponds to the BUILD.

⑦maven Local Warehouse

C:\Users\Administrator\.m2\Repository

⑧maven repository:xxx Retrieving the required jar packages

  

2017/1/7 Learning notes jar package, maven

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.