Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven: is there a simple command to test repository access?

Tags:

maven

nexus

Some of my users have trouble accessing our local Nexus repository. Some of them are somewhat newbies in maven configuration. Sure they can test if everything is downloading fine running mvn install, but I'd like to help them to isolate their environment problems.

Is there a simple mvn command just to test if the repository access is correctly configured?

like image 769
neves Avatar asked Jun 28 '18 22:06

neves


People also ask

How do I access my maven repository?

1) Just run command mvn --version . Go to maven installation directory and view the content of settings. xml file under conf folder. It should tell you which maven central repository is being used.

What does mvn test do?

mvn test-compile: Compiles the test source code. mvn test: Runs tests for the project. mvn package: Creates JAR or WAR file for the project to convert it into a distributable format. mvn install: Deploys the packaged JAR/ WAR file to the local repository.

What does the mvn clean command do?

mvn clean This command cleans the maven project by deleting the target directory.

Does mvn clean install run tests?

Running 'mvn clean install' will run the default build. As specified above integration tests will be ignored. Running 'mvn clean install -P integration-tests' will include the integration tests (I also ignore my staging integration tests).


3 Answers

Use

mvn help:effective-settings
like image 69
MiamiBeach Avatar answered Oct 13 '22 18:10

MiamiBeach


A simple

mvn clean

test the repository access.

like image 1
neves Avatar answered Oct 13 '22 16:10

neves


I had a number of dependencies that failed to download from the Maven Central repository (apparently due to network throttling/flakiness). Running "mvn clean" just immediately returned with the same errors, obviously not attempting any more downloads. But its message said to rerun with "-x" option to see the full stack trace, so I ran:

mvn clean -x

This caused it to retry and download more. It took several tries to get all dependencies downloaded, but it did eventually run to completion. It didn't give me any stack traces, and I still don't know what was causing the failures (the repository was reachable the whole time).

like image 1
Ron HD Avatar answered Oct 13 '22 17:10

Ron HD