Reputation: 1
I have searched a lot but couldn't find proper solution. Downloading dll files from raw repository (Nexus Sonatype) produces errors.
Nexus version is OSS 3.13.0-01
I tried to download the file using browser From the UI of nexus repository
I tried using cURL but it also produces the same error.
C:\Users\admin\Desktop>curl -X GET -u admin "http://url/repository/repositoryname/test.dll"
Enter host password for user 'admin':
<html>
<head>
<title>File Download Blocked</title>
<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
<meta name="viewport" content="initial-scale=1.0">
<style>
#content {
border:3px solid#aaa;
background-color:#fff;
margin:1.5em;
padding:1.5em;
font-family:Tahoma,Helvetica,Arial,sans-serif;
font-size:1em;
}
h1 {
font-size:1.3em;
font-weight:bold;
color:#196390;
}
b {
font-weight:normal;
color:#196390;
}
</style>
</head>
<body bgcolor="#e7e8e9">
<div id="content">
<h1>File Download Blocked</h1>
<p>Access to the file you were trying to download has been blocked in accordance with company policy. Please contact your system administrator if you believe this is in error.</p>
<p><b>File name:</b> test.dll </p>
<script type="text/javascript">
<!--
function setCookie(name,value, expseconds)
{
var d=new Date();
d.setSeconds(d.getSeconds()+expseconds);
document.cookie=name+ "=" +escape(value)+ ((expseconds==null) ? "" : ";expires="+d.toUTCString());
}
-->
</script>
<noscript><h3 style="color:red; margin-top:0px; padding-top:0px;">This page requires Javascript. Please turn on Javascript.</h3></noscript>
Please click<input type="button" value="Continue" onClick="setCookie('PANID395251712', 1195897971, 30); window.location.href=window.location.href"> to download/upload the file.
</div>
</body>
</html>
Nexus repository is installed in the windows 2012 R2 server. I'm able to download the artifacts in the server. But above error is generated when I try to download artifacts in the local machine. The cURL command used is
curl -X GET -u admin "http://ip:port/repository/repositoryname/test.dll"
I'm new to nexus and any help would be appreciated.
Upvotes: 0
Views: 11825
Reputation: 150
I know this question has been around a while but I figured I'd post this as possible answer for anyone trying to figure out how to download the latest version of an artifact. This answer is an adaptation of one found in Sonatype's documentation.
The following script will download the latest version of the artifact from a Nexus server that utilizes basic auth:
curl [-u $USERNAME:$PASSWORD] -L -X GET "https://[nexus-repo-url]/service/rest/v1/search/assets/download?sort=version&repository=[test-repository]&maven.groupId=[org.springframework.boot]&maven.artifactId=[spring-boot-starter-test]&maven.extension=jar" > ./[spring-boot-starter-test.jar]
You will need to replace everything surrounded in brackets. Note that the -u
part of the url is optional and, in the above example, uses local environment variables to authenticate against the Nexus server.
Upvotes: 2