问题
I need to make my Tycho-Maven build work in offline mode, so I can deploy it to environments with no Internet connection and let people run the build from the previously downloaded artifacts for the third party code my app depends on. The product being built is an Eclipse RCP product, using the org.eclipse.tycho:target-platform-configuration
plug-in to load the dependencies from an RCP target file.
First I run mvn -Dmaven.repo.local=/some/path/ -DgeneratePom=true clean install
to create the artifacts, and that build succeeds. Then when I run mvn -Dmaven.repo.local=/some/path/ -o clean install
it fails because it's running in offline mode and there is no local cache available for http://download.eclipse.org/tools/cdt/releases/8.6
So then I run mvn -Dmaven.repo.local=/some/path/ dependency:go-offline
to make it download all the artifacts it needs for the build, but it fails with this message:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:resolve-plugins (resolve-plugins) on project : Nested: Could not transfer artifact com.google.guava:guava:jar:[10.0.1,14.0.1] from/to central (https://repo.maven.apache.org/maven2): Illegal character in path at index 60: https://repo.maven.apache.org/maven2/com/google/guava/guava/[10.0.1,14.0.1]/guava-[10.0.1,14.0.1].jar
Index 60 is the "[" character in the version range specifier for the guava jar. I have no idea where that URL gets created and why it's not URL-encoded. It would be nice to get the dependency:go-offline goal to complete execution, but I don't think it's the source of my problem.
The reason I say that is when I run that goal, I see this in the output
[INFO] Adding repository http://download.eclipse.org/tools/cdt/releases/8.6 [INFO] Fetching p2.index from http://download.eclipse.org/tools/cdt/releases/8.6/r/ (0B at 0B/s)
I don't know why it downloads 0 Bytes, but I assume this is why I can't find a cache of the CDT bundles when I try to do an offline build.
If anyone has an idea how to work around this failure, or any other approach to make an offline build work, that would be very helpful.
回答1:
I created this Maven bug report in the issue tracker.
回答2:
In the course of creating a stripped down project to demonstrate the problem, I discovered the cause. The presence of org.eclipse.xtend:xtend-maven-plugin
in the pom was causing the problem. The plug-in is not used, and was perhaps misconfigured, per a message I saw in the build output.
来源:https://stackoverflow.com/questions/32916951/maven-offline-build-fails-when-it-encouners-google-guava-url-with-invalid-charac