I think you want to also say that this repository is a mirror of * as well.

Interesting concept...

On Mar 19, 2010, at 10:54 AM, jimmi4664 <[email protected]> wrote:


Please do not recommend setting up a local repository manager, I am aware of
those but would like to try this approach.

My Maven project needs to be built in an offline computer. I am trying to
create a snapshot of my repository using an online machine and mvn
dependency:go-offline, and then move this snapshot repository to the offline
machine and build there.

My approach is basically "Taking Maven completely Off-Line" from
http://stubbisms.wordpress.com/2008/08/28/maven-is-to-ant-as-a-nail-gun-is-to-hammer-and-nails-you-need-to-move-on/

I can create the "offline repository" fine and it contains all my plugins
and jar dependencies nicely. I move this for example to
c:\repo\offline-repo-4\. For example maven-resources-plugin looks like:

C:\repo\offline-repo-4\org\apache\maven\plugins\maven-resources- plugin\2.3>dir
19.03.2010  16:33            21 348 maven-resources-plugin-2.3.jar
19.03.2010 16:33 40 maven-resources- plugin-2.3.jar.sha1
19.03.2010  16:33             4 683 maven-resources-plugin-2.3.pom
19.03.2010 16:33 40 maven-resources- plugin-2.3.pom.sha1

At step 7 I add the "offline repository" config to my pom.xml:

       <repositories>
       <repository>
           <releases />
           <id>offline-repository</id>
           <name>local offline build repo</name>
           <url>file:///c:/repo/offline-repo-4/</url>
       </repository>
   </repositories>

So, before attempting to build at step 8, my local "normal" repository at C:\Documents and Settings\myusername\.m2 is empty, I have this "offline repo" that should contain all that I need, and I have configured my pom.xml to use it. To simulate offline build properly, I disable network connection
before building. Then if I try offline building:

D:\projects\zzz2>mvn package -offline
[INFO]
NOTE: Maven is executing in offline mode. Any artifacts not already in your
local
repository will be inaccessible.

[INFO] Scanning for projects...
[INFO]
--- ---------------------------------------------------------------------
[INFO] Building safProto - AppFramework Application
[INFO]    task-segment: [package]
[INFO]
--- ---------------------------------------------------------------------
[INFO]
--- ---------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO]
--- ---------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).


Project ID: org.apache.maven.plugins:maven-resources-plugin

Reason: POM 'org.apache.maven.plugins:maven-resources-plugin' not found in
repository: System is offline.

 org.apache.maven.plugins:maven-resources-plugin:pom:2.3


for project org.apache.maven.plugins:maven-resources-plugin


and if I try normal build without the -offline:

D:\projects\zzzz2>mvn package
[INFO] Scanning for projects...
[INFO]
--- ---------------------------------------------------------------------
[INFO] Building safProto - AppFramework Application
[INFO]    task-segment: [package]
[INFO]
--- ---------------------------------------------------------------------
Downloading:
http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.3/maven-resources-plugin-2.3.pom
[WARNING] Unable to get resource
'org.apache.maven.plugins:maven-resources-plugin:pom:2.3' from repository
central (http://repo1.maven.org/maven2): Error transf
erring file: repo1.maven.org
Downloading:
file:///c:/repo/offline-repo-4//org/apache/maven/plugins/maven- resources-plugin/2.3/maven-resources-plugin-2.3.pom
4K downloaded  (maven-resources-plugin-2.3.pom)
Downloading:
http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-plugins/12/maven-plugins-12.pom
[WARNING] Unable to get resource
'org.apache.maven.plugins:maven-plugins:pom:12' from repository central
(http://repo1.maven.org/maven2): Error transferring fil
e: repo1.maven.org
Downloading:
file:///c:/repo/offline-repo-4//org/apache/maven/plugins/maven- plugins/12/maven-plugins-12.pom
11K downloaded  (maven-plugins-12.pom)
Downloading:
http://repo1.maven.org/maven2/org/apache/maven/maven-parent/9/maven-parent-9.pom
[WARNING] Unable to get resource 'org.apache.maven:maven-parent:pom: 9' from repository central (http://repo1.maven.org/maven2): Error transferring file:
repo1.m
aven.org
Downloading:
file:///c:/repo/offline-repo-4//org/apache/maven/maven-parent/9/ maven-parent-9.pom
32K downloaded  (maven-parent-9.pom)
Downloading: http://repo1.maven.org/maven2/org/apache/apache/4/apache-4.pom
[WARNING] Unable to get resource 'org.apache:apache:pom:4' from repository
central (http://repo1.maven.org/maven2): Error transferring file:
repo1.maven.org
Downloading:
file:///c:/repo/offline-repo-4//org/apache/apache/4/apache-4.pom
4K downloaded  (apache-4.pom)
Downloading:
http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.3/maven-resources-plugin-2.3.jar
[WARNING] Unable to get resource
'org.apache.maven.plugins:maven-resources-plugin:maven-plugin:2.3' from
repository central (http://repo1.maven.org/maven2): Err
or transferring file: repo1.maven.org
[INFO]
--- ---------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO]
--- --------------------------------------------------------------------- [INFO] A required plugin was not found: Plugin could not be found - check that the goal name is correct: Unable to download the artifact from any
repository

Try downloading the file manually from the project website.

Then, install it using the command:
   mvn install:install-file -DgroupId=org.apache.maven.plugins
-DartifactId=maven-resources-plugin -Dversion=2.3 -Dpackaging=maven- plugin
-Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file
there:
   mvn deploy:deploy-file -DgroupId=org.apache.maven.plugins
-DartifactId=maven-resources-plugin -Dversion=2.3 -Dpackaging=maven- plugin
-Dfile=/path/to/file -D
url=[url] -DrepositoryId=[id]


 org.apache.maven.plugins:maven-resources-plugin:maven-plugin:2.3

from the specified remote repositories:
 central (http://repo1.maven.org/maven2)


 org.apache.maven.plugins:maven-resources-plugin:maven-plugin:2.3

from the specified remote repositories:
 central (http://repo1.maven.org/maven2)

The latter creates to my "normal local repo" (C:\Documents and....)
following:

C:\Documents and
Settings\username\.m2\repository\org\apache\maven\plugins\maven- resources-plugin\2.3>dir
19.03.2010  16:41             4 683 maven-resources-plugin-2.3.pom
19.03.2010 16:41 40 maven-resources- plugin-2.3.pom.sha1

So it seems Maven is able to get the pom and it's sha1 from the "offline
repo" but for some reason does not fetch the jar from the same place.

What's going on here....I would like to understand?
--
View this message in context: 
http://old.nabble.com/Creating-repository-for-offline-building-with-dependency%3Ago-offline-fails-tp27950979p27950979.html
Sent from the Maven - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to