0

I would like to know if there is any way to embed native java libraries in maven as dependency or something like that but from the internet not from local.

Like java.util or all that jdk provides.

Example of "pom.xml":

<dependency>
    <groupId>jdk</groupId>
    <artifactId>java.util.arraylist</artifactId>
    <version>1.1.3</version>
</dependency>
1
  • 3
    Why do you want to do that? Commented Nov 8, 2016 at 21:23

2 Answers 2

3

All of the standard, built-in Java classes are available to your build already - you don't need to add them as dependencies.

If you have a jar (possibly home-built) that you need to use in your maven build as a dependency, you can add it to your local maven repository as an artefact and have your pom.xml depend upon it as normal.

mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> \
    -DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>

For more details, see this SO answer, or this Maven reference for details on how to perform this.

Sign up to request clarification or add additional context in comments.

Comments

-1

Think of Maven as an infrastructure that handles dependencies.

mvn install

Write to local Maven directory on your machine.

mvn deploy

Write to an external repository server, e.g. Nexus, so it can be shared with others. (Your local Maven must be configured to recognize this Nexus.)

See https://maven.apache.org/run.html

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.