[JAVA] How to add local jar to maven pom.xml

Introduction

Creating a public repository is easy with jenkins, but preparing jenkins is a hassle. That's why you should create a local repository.

At the library

mvn install
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.haniokasai:cpulimitController:jar:1.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-jar-plugin is missing. @ line 44, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building cpulimitController 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ cpulimitController ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ cpulimitController ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ cpulimitController ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory Z:\users\doc\GitHub\cpulimitController\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ cpulimitController ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ cpulimitController ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ cpulimitController ---
[INFO]
[INFO] --- maven-shade-plugin:2.4.3:shade (default) @ cpulimitController ---
[INFO] Replacing original artifact with shaded artifact.
[INFO] Replacing Z:\users\doc\GitHub\cpulimitController\target\cpulimitController-1.0-SNAPSHOT.jar with Z:\users\doc\GitHub\cpulimitController\target\cpulimitController-1.0-SNAPSHOT-shaded.jar
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ cpulimitController ---
[INFO] Installing Z:\users\doc\GitHub\cpulimitController\target\cpulimitController-1.0-SNAPSHOT.jar to C:\Users\What a certain\.m2\repository\com\haniokasai\cpulimitController\1.0-SNAPSHOT\cpulimitController-1.0-SNAPSHOT.jar
[INFO] Installing Z:\users\doc\GitHub\cpulimitController\pom.xml to C:\Users\What a certain\.m2\repository\com\haniokasai\cpulimitController\1.0-SNAPSHOT\cpulimitController-1.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.164 s
[INFO] Finished at: 2018-11-09T01:25:11+09:00
[INFO] Final Memory: 9M/128M
[INFO] ------------------------------------------------------------------------

Then, pom or jar is installed in C: \ Users \ something \ .m2 \ repository .

By the person who uses

Add local repository

pom.xml


    <repositories>
        <repository>
            <id>localrepo</id>
            <name>localrepo</name>
            <url>file://${basedir}/libs/</url>
        </repository>
    </repositories>

further

pom.xml


        <dependency>
            <groupId>com.haniokasai</groupId>
            <artifactId>cpulimitController</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>

Just write.

And in this case in the ./libs folder, the jar, pom and _remote.repositories inside C: \ Users \ what \ .m2 \ repository \ com \ haniokasai \ cpulimitController Should be left.

Ref https://stackoverflow.com/questions/18732175/the-pom-for-project-is-missing-no-dependency-information-available

Recommended Posts

How to add local jar to maven pom.xml
How to add jar file in ScalaIDE
Add files to jar files
Add jar file obtained from Maven to IntelliJ
How to build an executable jar in Maven
How to add ActionText function
How to add HDD to Ubuntu
[Java] [Maven] Template of pom.xml to register 3rd party jar file in local repository
How to use Maven to place resource files outside the JAR
How to add Hyperledger Iroha Peer
How to add columns to a table
[Rails] How to add new pages
How to make a Maven project
How to add the delete function
How to make a jar file with no dependencies in Maven
How to deploy an app that references a local jar to heroku
[Xcode] How to add a README.md file
[Java] How to add data to List (add, addAll)
How to add a new hash / array
How to create a Maven repository for 2020
How to set JAVA_HOME with Maven appassembler-maven-plugin
[Java] [Maven3] Summary of how to use Maven3
How to add application version information to Sentry information
How to add / remove Ruby on Rails columns
How to add sound in the app (swift)
How to deploy
How to add a classpath in Spring Boot
How to conditionally add html.erb class in Rails
How to deploy to Heroku from a local docker image
How to use Maven that I can't hear anymore
How to add characters to display when using link_to method
Use Maven to add your favorite Java library to your environment.
How to start tomcat local server without using eclipse
How to debug the generated jar file in Eclipse
How to boot by environment with Spring Boot of Maven
Maven repository local cache
How to develop OpenSPIFe
Introduction to JAR files
How to call AmazonSQSAsync
How to use Map
How to write Rails
How to use rbenv
How to use letter_opener_web
How to use with_option
How to use fields_for
How to use java.util.logging
How to use map
How to use collection_select
How to adapt Bootstrap
How to add another project as Maven library with CircleCI and use it for build
How to use Twitter4J
How to use active_hash! !!
How to install Docker
How to use MapStruct
How to read a library from a JAR file with VS Code << How to not use Maven / Gradle >>
How to use hidden_field_tag
How to use TreeSet
How to write dockerfile
How to uninstall Rails
How to install docker-machine
[How to use label]