简体   繁体   中英

how include my local jar to maven?

the question is:

i start a local lib to collect some common utils in it.

then i use eclipse m2e to run as Maven Install, and it truely generate the jar into my local cached repos dir.

and now, i want to use that lib as a dependency in my project, i just type the dependency xml as the other (like spring etc.).

but it just can load that lib in the maven dependencies libs.

I search the web and find that systemPath could work, but i don' t like this way. how can i use my local jar in a same way?

Install it into your repository. Either local ( mvn install ) or run repository software like Artifactory, Archiva or Nexus. http://maven.apache.org/repository-management.html

You can do a (non-Maven) build and:

(I have even resorted to using an "internal repository" that was part of the project's version control check-out; ie putting the JAR into version control.)

But I think that the best approach would be to Mavenize the build for the utility JAR, and handle it just like your main Maven projects.

Use goal install-file . Like , mvn install-file .

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