I have been running into this problem when attempting to download an archive
from a remote repository in a variety of ways as I attempted to work around
it.  I uploaded and verified the installation of an archive on a server that
I set up via sftp.  When I trigger a download, it seems to want to install
the archive in a directory on my machine that mirrors its location on the
remote server, rather than installing it in my local .m2 (maven2)
repository.

Rather than give a long explanation, I coded up a pair of build scripts, one
to create and upload the archive and another to unzip the archive.  I tried
to use code that is very close to documentation example code, so that any
complexities are eliminated.  Here's the details (with security sensitive
details obscured.

1. A simple buildfile for a jar that has a single class in it.
...src/main/java/org/screwloose/repotest/RepoStub.java
  a. the buildfile
VERSION_NUMBER = "1.0.0"
# Group identifier for your projects
GROUP = "repotest"
COPYRIGHT = ""
# Specify Maven 2.0 remote repositories here, like this:
repositories.remote << "http://www.ibiblio.org/maven2/";
# Specify Maven 2.0 remote repository to release to
repositories.release_to = 'sftp://
someuser:[email protected]/usr/share/maven2/'
desc "The Repotest project"
define "repotest" do
  project.version = VERSION_NUMBER
  project.group = GROUP
  manifest["Implementation-Vendor"] = COPYRIGHT
  package(:jar)
end
  b. running the buildfile
~/somedirectory/research/repotest $ buildr upload
(in /somehomedirs/myusername/somedirectory/research/repotest, development)
Building repotest
Packaging repotest
Running integration tests...
Deploying packages from repotest
Deploying repotest:repotest:pom:1.0.0
Deploying repotest:repotest:jar:1.0.0
Completed in 13.721s

2. Another stub buildfile with a compile, and hence, a build, dependency on
downloading the jar from the remote.
  a. the stub
# Generated by Buildr 1.3.5, change to your liking
# Version number for this release
VERSION_NUMBER = "1.0.0"
# Group identifier for your projects
GROUP = "repotest"
COPYRIGHT = ""
# Specify Maven 2.0 remote repositories here, like this:
repositories.remote << 'sftp://
someuser:[email protected]/usr/share/maven2/'
repositories.remote << "http://www.ibiblio.org/maven2/";
desc "The Repotest Test Archive project"
define "testarch" do
  project.version = VERSION_NUMBER
  project.group = GROUP
  manifest["Implementation-Vendor"] = COPYRIGHT
  the_jar = artifact('repotest:repotest:jar:1.0.0')
  task :unzip_jar => unzip(_("target/stuff") => the_jar) do
     compile.with Dir[_("target/stuff/WEB-INF/lib") + "/*.jar"]
  end
  task :compile => :unzip_jar
end

  b. running the test script with trace
~/somedirectory/research/repotest $ buildr -f testsarc.rb --trace
(in /somehomedirs/myusername/somedirectory/research/repotest, development)
** Invoke testarch (first_time)
** Execute testarch
Defining task testarch:shell:jirb
Defining task testarch:shell:clj
Defining task testarch:shell:bsh
** Invoke
/somehomedirs/myusername/.m2/repository/org/apache/ant/ant/1.7.1/ant-1.7.1.jar
(first_time, not_needed)
** Invoke
/somehomedirs/myusername/.m2/repository/org/apache/ant/ant-launcher/1.7.1/ant-launcher-1.7.1.jar
(first_time, not_needed)
** Invoke
/somehomedirs/myusername/.m2/repository/org/apache/ant/ant-trax/1.7.1/ant-trax-1.7.1.jar
(first_time, not_needed)
** Invoke /somelibrarydir/Ruby/Gems/1.8/gems/buildr-1.3.5/lib/buildr/java
(first_time, not_needed)
Defining task shell based on shell:bsh
** Invoke testarch
** Invoke default (first_time)
** Invoke build (first_time)
** Execute build
Building testarch
** Invoke testarch:build (first_time)
** Invoke
/somehomedirs/myusername/somedirectory/research/repotest/target/classes
(first_time, not_needed)
** Invoke testarch:compile (first_time, not_needed)
** Invoke testarch:resources (first_time)
** Execute testarch:resources
** Invoke testarch:unzip_jar (first_time)
** Invoke
/somehomedirs/myusername/somedirectory/research/repotest/target/stuff
(first_time)
** Invoke
/somehomedirs/myusername/.m2/repository/repotest/repotest/1.0.0/repotest-1.0.0.jar
(first_time)
** Execute
/somehomedirs/myusername/.m2/repository/repotest/repotest/1.0.0/repotest-1.0.0.jar
Downloading repotest:repotest:jar:1.0.0
Downloading repotest:repotest:jar:1.0.0
Connecting to someserver.somedomain.com
connected
Downloading to /usr/share/maven2/repotest/repotest/1.0.0/repotest-1.0.0.jar
[hangs for an hour or more….<===========================]

Reply via email to