I'm sitting behind a firewall and therefore maven can't connect to central repositories (error message is given below).
However, I can connect to the internet via HTTP.
How can I install a maven plugin (e. g. archetype) in offline mode (i. e. download some file in a browser and then install the plugin by executing some commands) ?
Thanks in advance
Dmitri
P. S.: Here is the error message:
E:\>mvn archetype:generate -DarchetypeGroupId=com.vaadin
-DarchetypeArtifactId=vaadin-archetype-clean -DarchetypeVersion=LATEST -DgroupI
d=at.swdev -DartifactId=pcc -Dversion=1.0 -Dpackaging=war
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'archetype'.
[INFO] org.apache.maven.plugins: checking for updates from central
[WARNING] repository metadata for: 'org.apache.maven.plugins' could not be retri
eved from repository: central due to an error: Error transferring file: Connecti
on refused: connect
[INFO] Repository 'central' will be blacklisted
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] The plugin 'org.apache.maven.plugins:maven-archetype-plugin' does not exi
st or no valid version could be found
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Thu Jul 22 15:17:00 CEST 2010
[INFO] Final Memory: 1M/15M
[INFO] ------------------------------------------------------------------------
The go-offline goal of the Maven Dependency plugin downloads all the required dependencies and plugins for the project, based on the pom file. The –o option tells Maven to work offline and not check the Internet for anything.
In order to prepare for offline mode, we can use the go-offline goal from the maven-dependency-plugin: mvn dependency:go-offline. This goal resolves all project dependencies — including plugins and reports and their dependencies. After running this goal, we can safely work in offline mode.
The dependency plugin provides the capability to manipulate artifacts. It can copy and/or unpack artifacts from local or remote repositories to a specified location.
☑️Open a project that you want to build offline. ☑️Run the following command: mvndependency:go-offline.
I'm sitting behind a firewall and therefore maven can't connect to central repositories (error message is given below). However, I can connect to the Internet via HTTP.
Maybe you should clarify a bit because Maven uses HTTP as well. If you connect through some kind of proxy, you CAN configure Maven to do so by declaring the proxy in your ~/.m2/settings.xml
. See Configuring a proxy.
How can I install a maven plugin (e. g. archetype) in offline mode (i. e. download some file in a browser and then install the plugin by executing some commands)?
You can install any jar in your local repository using the install:install-file
goal (see the Usage page). But this is only a small part of the story, you'll need to install dependencies of the plugin too. And then dependencies of dependencies. This will very quickly become a real nightmare and unmanageable task (that Maven precisely tries to solve). So either:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With