问题
I am getting an warning message because I manually added a jar file to my local maven repository.
[INFO] Downloading: http://repo.maven.apache.org/maven2/com/netsuite/nsws-2014/1.0/nsws-2014-1.0.pom
[WARNING] The POM for com.netsuite:nsws-2014:jar:1.0 is missing, no dependency information available
How do I properly add a jar file to my local Maven repository using Eclipse m2e on Luna Service (4.4.1)?
Like can I use the builder?
回答1:
The local Maven repository is effectively a standard Maven repository; as such, it must adhere to a particular format (there are a few Maven-compatible repository formats).
Dropping files into a repository isn't going to cut it, unless you are able to mimic the creation of additional artifacts in accordance to the Maven repository format that you use.
The only foolproof way to do so would be to use the install:install-file goal, as specified here: http://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html
To do this using m2e, you need to use a small hack. Create a Maven Launch configuration. In the "base directory" field, type in a value that will always resolve to a real directory, such as ${workspace_loc}. In the "Goals", field, type install:install-file, and then add the parameters (see the link in the paragraph below) in the "parameters" table (use the "Add" button to add parameters). Then run this launch configuration.
回答2:
You should add jar to your local repository like:
mvn install:install-file -DgroupId=... -DartifactId=... -Dversion=... -Dpackaging=jar -Dfile=... -DgeneratePom=true
-DgeneratePom=true genertes POM automatically...
回答3:
You need to declare <scope>system</scope> like
<dependency>
<groupId>com.netsuite</groupId>
<artifactId>nsws-2014</artifactId>
<version>1</version>
<scope>system</scope>
<systemPath>/path/to/your.jar</systemPath>
</dependency>
来源:https://stackoverflow.com/questions/28623900/how-do-i-add-a-jar-file-to-my-local-maven-repository-using-eclipse-m2e-on-luna-s