Dirty work: Maven issue to JFrog
Recently, I found a trouble I used maven with JFrog.
Actually at home, I can easily use Maven to get what libraries I want remotely.
However, in company, I cannot do that.
As a several experiences for Gradle. I bet proxy is the issue.
Cannot connect to repo.maven.apache.org/maven2/
I tried many setting in pom.xml. But all failed.
Finally I found setting.xml
is my hero!
The location of setting.xml
is in ~/.m2
, it is not easy to know it.
When we find setting.xml
file, we can solve the problem easily.
<proxies>
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<host><company proxy></host>
<port>8080</port>
<nonProxyHosts><company proxy></nonProxyHosts>
</proxy>
</proxies>
If you have username or password for proxy, just type it.
And we will solve the issue.
a “401 Unauthorized” error when I deploy in Maven?
It clearly caused by username and password.
However how do we set them?
Also, setting.xml
is our best friend.
in ~/.m2/setting.xml
, just edit the following:
<servers>
<server>
<id>snapshots</id>
<username>$username</username>
<password>$password</password>
</server>
<server>
<id>releases</id>
<username>$username</username>
<password>$password</password>
</server>
</servers>
Notice: the id must be both of them
$username and $password is the username and password for our JFROG!
In the end, we will solve the issue!