88
99root_url () {
1010 test snapshots ! = " $2 " || {
11- echo http://maven.imagej.net/content/repositories/snapshots
11+ if curl -fs http://maven.imagej.net/content/repositories/snapshots/" $1 " / > /dev/null 2>&1
12+ then
13+ echo http://maven.imagej.net/content/repositories/snapshots
14+ else
15+ echo http://maven.imagej.net/content/repositories/sonatype-snapshots
16+ fi
1217 return
1318 }
1419 echo http://maven.imagej.net/content/groups/public
@@ -108,17 +113,17 @@ project_url () {
108113 version=" $( version " $gav " ) "
109114 case " $version " in
110115 * SNAPSHOT)
111- echo " $( root_url $artifactId snapshots) /$infix "
116+ echo " $( root_url $infix snapshots) /$infix "
112117 ;;
113118 * )
114119 # Release could be in either releases or thirdparty; try releases first
115- project_url=" $( root_url $artifactId releases) /$infix "
120+ project_url=" $( root_url $infix releases) /$infix "
116121 header=$( curl -Is " $project_url /" )
117122 case " $header " in
118123 HTTP/1.? " 200 OK" * )
119124 ;;
120125 * )
121- project_url=" $( root_url $artifactId thirdparty) /$infix "
126+ project_url=" $( root_url $infix thirdparty) /$infix "
122127 ;;
123128 esac
124129 echo " $project_url "
@@ -135,15 +140,15 @@ jar_url () {
135140 infix=" $( groupId " $gav " | tr . /) /$artifactId /$version "
136141 case " $version " in
137142 * -SNAPSHOT)
138- url=" $( root_url $artifactId snapshots) /$infix /maven-metadata.xml"
143+ url=" $( root_url $infix snapshots) /$infix /maven-metadata.xml"
139144 metadata=" $( curl -s " $url " ) "
140145 timestamp=" $( extract_tag timestamp " $metadata " ) "
141146 buildNumber=" $( extract_tag buildNumber " $metadata " ) "
142147 version=${version% -SNAPSHOT} -$timestamp -$buildNumber
143- echo " $( root_url $artifactId snapshots) /$infix /$artifactId -$version .jar"
148+ echo " $( root_url $infix snapshots) /$infix /$artifactId -$version .jar"
144149 ;;
145150 * )
146- echo " $( root_url $artifactId releases) /$infix /$artifactId -$version .jar"
151+ echo " $( root_url $infix releases) /$infix /$artifactId -$version .jar"
147152 ;;
148153 esac
149154}
0 commit comments