简体   繁体   中英

Build war with maven

I have a local jar in my project and I can't do

mvn compile war:war

because I get this error:

Failure to find myLib in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]

What do I need to add to the pom to fix this?

You can not access the maven central repository on the internet. The information is a bit vague so I would try all of these steps as a check, you may well have already done some.

Start by downloading maven from http://mirror.vorboss.net/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.zip

Unzip it somewhere, then assuming your're on windows

1) set an environment variable M2_HOME to point at the unziped folder.

2) add %M2_HOME%/bin to your PATH environment variable

3) go to your home directory (probably C:/Users/????? and create a .m2 folder

4) move the settings.xml file from the maven unzippped/conf directory to the directory created in step 3.

5) you may have to set the proxy element correctly in your settings.xml file (see here for details)

Check all is working by doing:

greg@greg-XPS-13-9360:~/work/local-repo$ mvn -version
Apache Maven 3.3.9
Maven home: /usr/share/maven
Java version: 1.8.0_161, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-oracle/jre
Default locale: en_GB, platform encoding: UTF-8
OS name: "linux", version: "4.4.0-112-generic", arch: "amd64", family: "unix"

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