MAVEN relies on a jar package in a local non-repository

Source: Internet
Author: User

Scope of the dependency

When defining a project's dependencies, we can specify the scope of the dependency by scope. Scope values are compile, runtime, test, provided, system, and import.

Compile: This is the default scope for dependencies, which means that compile is used by default when no scope is specified for a dependency. Dependencies in the compile range are valid in all cases, including run, test, and compile time.

Runtime: Indicates that the dependency is required only at run time and is not required at compile time. This type of dependency will be accessible under the classpath of Run and test.

Test: Indicates that the dependency is only useful for testing, including the compilation and operation of the test code, and has no effect on normal project operation.

provided: Indicates that the dependency will be provided by the JDK or run container at runtime, which means that the dependency provided by Maven is only used when compiling and testing, and will be provided by the JDK or runtime container at runtime.

system: When scope is system, it means that the dependency is provided by us and does not need maven to go to the warehouse to find it. Specifying scope as system needs to be used with another property element, Systempath, which represents the location of the dependency on the current system, using an absolute path. For example, the website gives a tools.jar about using the JDK:

<Project>  ...  <Dependencies>    <Dependency>      <groupId>Sun.jdk</groupId>      <Artifactid>Tools</Artifactid>      <version>1.5.0</version>      <Scope>System</Scope>      <Systempath>${java.home}/. /lib/tools.jar</Systempath>    </Dependency>  </Dependencies>  ...</Project>

MAVEN relies on a jar package in a local non-repository

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.