Hi folks,

we have a requirement for a source code escrow 
(https://en.wikipedia.org/wiki/Source_code_escrow). Therefore we intended 
provide our source code with a local Maven repository that can be used for 
offline builds. However, all attempts have been failed so far.

What have we done:
1/ Checked out the tagged versions of our software
2/ Build it with M339 (mvn package) using an empty local Maven repo
As result all released artifacts are recreated in the target directories - 
so far so good.

As next step we took a copy of the local repo and of the cleaned sources to 
a new location and created naively a settings.xml containing two entries 
only:
- the location to the copy of the local repo
- offline set to true

We use JDK 1.7 and tried the different M3 versions (3.0.5, 3.1.1, 3.2.5, 
3.3.9):

First try with Maven 3.0.5:
============= %< ================
jos@josoo /tmp/kde-jos/offline $ mvn -s settings.xml -f source/pom.xml clean 
package 
[INFO] Scanning for projects...
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   
[ERROR]   The project ip.users:ip-users-ear:4.4.1 (/tmp/kde-
jos/offline/source/ip.users/ip-users-ear/pom.xml) has 1 error
[ERROR]     Unresolveable build extension: Error resolving version for 
plugin 'org.apache.maven.plugins:maven-eclipse-plugin' from the repositories 
[local (/tmp/kde-jos/offline/local.repo), central 
(http://repo.maven.apache.org/maven2)]: Plugin not found in any plugin 
repository -> [Help 2]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e 
switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please 
read the following articles:
[ERROR] [Help 1] 
http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] 
http://cwiki.apache.org/confluence/display/MAVEN/PluginVersionResolutionException
============= %< ================
$ ls -l local.repo/org/apache/maven/plugins/maven-eclipse-plugin/ 
drwxr-xr-x 2 jos jos 4096 Nov 13 09:47 2.10
============= %< ================

For whatever reason, it does not accept the maven-eclipse-plugin in the 
local repo (although it is just declared, but not used in the build itself). 
(And yes, it has no sticky version, the newest might always create the best 
project...)

Try with Maven 3.1.1/3.2.5/3.3.9 (all the same):
============= %< ================
$ mvn -s settings.xml -f source/pom.xml clean package     
[INFO] Scanning for projects...
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   
[ERROR]   The project builder:source:x-SNAPSHOT (/tmp/kde-
jos/offline/source/pom.xml) has 1 error
[ERROR]     Non-resolvable parent POM: Cannot access central 
(http://repo.maven.apache.org/maven2) in offline mode and the artifact 
com.scalaris.buildsystem.maven2:master:pom:274 has not been downloaded from 
it before. and 'parent.relativePath' points at no local POM @ line 6, column 
13 -> [Help 2]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e 
switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please 
read the following articles:
[ERROR] [Help 1] 
http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] 
http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
============= %< ================
$ ls -l local.repo/com/scalaris/buildsystem/maven2/master
drwxr-xr-x 2 jos jos 4096 Nov 13 09:47 274
============= %< ================

The "unresolvable" parent is obviously available in the local repo.

As next step we added an active profile to settings.xml with repository 
definitions using the same ids we had originally, but with a URL pointing to 
nowhere (file:///). This makes no difference for M305, but all versions 
3.1.1 and higher start to accept the artifacts available in the local 
repository ... unless the first project in the build uses the maven-
assembly-artifact:

============= %< ================
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-
plugin:2.4.1:single (create-assemblies) on project fileupload-app: Failed to 
create assembly: Unable to resolve dependencies for assembly 'app': Failed 
to resolve dependencies for assembly: Missing:
[ERROR] ----------
[ERROR] 1) commons-codec:commons-codec:jar:1.6
[ERROR] 
[ERROR] Try downloading the file manually from the project website.
[ERROR] 
[ERROR] Then, install it using the command:
[ERROR] mvn install:install-file -DgroupId=commons-codec -
DartifactId=commons-codec -Dversion=1.6 -Dpackaging=jar -Dfile=/path/to/file
[ERROR] 
[ERROR] Alternatively, if you host your own repository you can deploy the 
file there:
[ERROR] mvn deploy:deploy-file -DgroupId=commons-codec -DartifactId=commons-
codec -Dversion=1.6 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -
DrepositoryId=[id]
[ERROR] 
[ERROR] Path to dependency:
[ERROR] 1) com.essencio.components.fileupload:fileupload-app:jar:4.4.0
[ERROR] 2) com.scalaris.commons:scalaris-commons-run:jar:2.2.1
[ERROR] 3) com.scalaris.commons:scalaris-commons-lang:jar:2.6.1
[ERROR] 4) commons-codec:commons-codec:jar:1.6
[...]
============= %< ================

Again, all the "unavailable" artifacts are already in the local repo.

Finally, using the -llr flag, the build with M311/M325 succeeds, but fails 
still with M339, because a 3rd party plugin cannot find its dependencies 
now:

============= %< ================
[ERROR] Failed to execute goal org.primefaces.extensions:resources-
optimizer-maven-plugin:1.0.0:optimize (optimize) on project ip-wwpbase: 
Execution optimize of goal org.primefaces.extensions:resources-optimizer-
maven-plugin:1.0.0:optimize failed: Plugin 
org.primefaces.extensions:resources-optimizer-maven-plugin:1.0.0 or one of 
its dependencies could not be resolved: The following artifacts could not be 
resolved: org.apache.maven:maven-model:jar:3.1.0, org.apache.maven:maven-
artifact:jar:3.1.0, org.apache.maven:maven-settings:jar:3.1.0, 
org.apache.maven:maven-settings-builder:jar:3.1.0, org.apache.maven:maven-
repository-metadata:jar:3.1.0, org.apache.maven:maven-model-
builder:jar:3.1.0, org.apache.maven:maven-aether-provider:jar:3.1.0, 
org.codehaus.plexus:plexus-classworlds:jar:2.4.2: Cannot access scalaris-
plugin-release (file:///) in offline mode and the artifact 
org.apache.maven:maven-model:jar:3.1.0 has not been downloaded from it 
before. -> [Help 1]
============= %< ================

Again, all the "unavailable" artifacts are already in the local repo. It 
seems M339 is missing some compatibility layer.

However, offline builds are very hard to accomplish. They are definitely no 
fun.

Cheers,
Jörg



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to