Maven offline - problem with mvn-plugins

maven offline mode
mvn dependency:go-offline not working
intellij maven offline mode
maven offline build
maven-dependency-plugin
maven dependency plugin 3.1 1 go offline
maven-dependency-plugin example
eclipse maven offline

I'm using maven in my project and I need to run the build in a non-internet-access machine.

When I test my project build everything is working, but when I run the build in a future moment, the maven try to update the mvn-plugins and this sht* is broking my build.

My config file: settings.xml from mvn.

    <profile>
      <id>blaProfile</id>
      <repositories>
        <repository>
          <id>blaRepo</id>
          <url>file://${bla.3rdParty.home}/maven/.m2/repository</url>
          <layout>default</layout>
        </repository>
      </repositories>
      <pluginRepositories>
        <pluginRepository>
          <id>blaRepo</id>
          <url>file://${bla.3rdParty.home}/maven/.m2/repository</url>
          <layout>default</layout>
        </pluginRepository>
      </pluginRepositories>
    </profile>

  <activeProfiles>
    <activeProfile>blaProfile</activeProfile>
  </activeProfiles>

And I ran my maven is with the params:

mvn -npu -bla.3rdParty.home="$(THE_CORRECT_PATH)" package

I saw that maven try to update some mvn-plugins for some time, but the option:

-npu,--no-plugin-updates      Suppress upToDate check for any relevant

Should work for this updates.

Well waiting some help on that!

Thanks in advance!


UPDATE(1): What I'm looking at, is that I could use the setting:

<usePluginRegistry>true</usePluginRegistry>

Inside my settings.xml and with this, I'll have a plugin-registry.xml inside ${user.home}/.m2 that I can config and force the maven plugins versions. But it's not working! :(

Before you go offline run the following:

mvn dependency:go-offline

That will download all your dependencies and plugins that you need to build your project into ~/.m2/repository.

Once you've run that you can now build your project offline using the '-o' flag:

mvn install -o

[#MDEP-82] go-offline / resolve-plugins does not resolve all plugin , go-offline / resolve-plugins does not resolve all plugin dependencies If you run "mvn -o package" afterwards, you end up with the following error: plugin 'org. apache.maven.plugins:maven-resources-plugin' does not exist� [ERROR] Plugin org.apache.maven.plugins:maven-resources-plugin:2.7 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.7: The repository system is offline but the artifact org.apache.maven.plugins:maven-resources-plugin:pom:2.7 is not available in the

In order to cache plugins into the .m2/repository folder you would need to specify all plugins explicitly with the mvn <maven-plugin-name>:help

You would also need to specify explicit version for each plugin in the <plugins> or <pluginsManagement> section of your pom.xml

<plugin> 
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-surefire-plugin</artifactId>
  <version>2.19</version>
  <dependencies>
    <dependency>
      <groupId>org.apache.maven.surefire</groupId>
      <artifactId>surefire-testng</artifactId>
      <version>2.19</version>
    </dependency>
  </dependencies>
</plugin>

This is needed to make sure that mvn install -o uses the same plugin version.

Ofcourse you would also need to run mvn dependency:go-offline to take care of your compile and test dependencies.

mvn assembly:help compiler:help enforcer:help exec:help failsafe:help install:help jar:help resources:help surefire:help mvn dependency:go-offline mvn compile --offline

Apache Maven Dependency Plugin – dependency:go-offline, Maven Plugin used to download all Dependencies and Plugins required in a Maven mvn de.qaware.maven:go-offline-maven-plugin:resolve-dependencies. Download all dependencies using a machine with normal/proxied http connection. Maven dependency plug-in has a goal which can help you. mvn dependency:go-offline. For example I use it to get maven dependencies of app-fuse tutorial.

It should suffice to run a mvn clean install on your code. The next time, when you run it in an offline mode you can use the following options:

mvn -Dmaven.repo.local=..\repository –o clean install

-o tells Maven not to try to update its dependencies over the network and with -Dmaven.repo.local you provide the path of the repository which contains all the required dependencies. Alternatively, you can add the path of the repository in your settings.xml in the localRepository tag and add an <offline>true</offline>. You can configure the same in your Maven Eclipse configurations.

qaware/go-offline-maven-plugin: Maven Plugin used to , for offline build, I get the following error [ERROR] Failed to execute goal org. apache.maven.plugins:maven-dependency-plugin:2.8:reso maven plugins for compiling, cleaning, packaging, etc? Does maven require a connection to the internet at some point to be able to use it? 71178/how-do-i-configure-maven-for-offline-development

I think this happens because Maven hasn't got the metadata available locally to determine if its plugin versions are correct. If you specify exact versions for your plugins (which is a good idea for reproducability anyway), it doesn't need to do the check, so will not try to connect to the remote repositories.

By specify exact versions, I mean that in your project's POM you should add the version to the plugin declaration. For example:

<plugins>
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <!-- set the version explicitly-->
    <version>2.0</version>
  </plugin>
</plugins>

Note you can also force Maven to use internal repositories instead of Central by setting up repository mirrors. See this answer for more details on using repository managers and mirrors.

In the config you included, you're setting your remote repository to point to your local repository, this is not a good idea. To run offline you should either pass -o at the command line or add this to your settings.xml:

<offline>true</offline>

Maven Build: When I do mvn dependency:go-offline I get an error , Open a project that you want to build offline. Run the mvn dependency:go- offline This is a known problem or limitation with the Maven Dependency plugin. Unfortunately some Maven Plugins dynamically load additional dependencies when they are run. Since those dependencies are not necessarily specified anywhere in the plugins pom.xml, the Go Offline Maven Plugin cannot know that it has to download those dependencies.

After some debugging I found that maven-dependency-plugin (version 3.1.1 at the time of writing) is unable to resolve plugin's dependencies when specified like:

<plugin>
 <groupId>org.apache.maven.plugins</groupId>
 <artifactId>maven-surefire-plugin</artifactId>
 <version>3.0.0-M3</version>
 <dependencies>
  <dependency>    <--- this is not going to be resolved by dependency:go-offline command !!!
   <groupId>org.apache.maven.surefire</groupId>
   <artifactId>surefire-junit4</artifactId>
   <version>3.0.0-M3</version>
  </dependency>
 </dependencies>
</plugin>

After that I found go-offline-maven-plugin which just works! Pls see https://github.com/qaware/go-offline-maven-plugin for more info.

<plugin>
 <groupId>de.qaware.maven</groupId>
 <artifactId>go-offline-maven-plugin</artifactId>
 <version>x.y.z</version>
</plugin>

Current version could be found here https://mvnrepository.com/artifact/de.qaware.maven/go-offline-maven-plugin and Maven issue here https://issues.apache.org/jira/browse/MDEP-82

Working in offline mode, Step 2: Run Maven to download dependencies for offline usage. In order the . jars needed for these goals when you run mvn dependency:go-offline . [INFO] Copying 11 resources [INFO] [INFO] --- maven-compiler-plugin:2.3.2:compile To resolve this issue we have to recursively delete all files with the� Another Stackoverflow user was having a similar problem and there are several things to try listed as answers to that question. Do any of the workarounds outlined on that question help you? Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved

Force Maven to execute offline with local repository dependencies in , mvn help:describe -Dcmd=compiler:compile $ mvn install -Dmaven.test.skip=true When running with the offline option enabled, Maven will not attempt to If you are reporting an unexpected problem with Maven or a Maven plugin, you will� Maven offline - problem with mvn-plugins. Ask Question Asked 10 years, 10 months ago. Active 6 months ago. Viewed 11k times 6. 1. I'm using

6.1. Maven Command Line Options, mvn org.apache.maven.plugins:maven-dependency-plugin:2.8:go-offline - Dmaven.repo.local=/tmp/cheese. Which downloads all the Maven dependencies and� Supported By The Maven Project. To see the most up-to-date list browse the Maven repository, specifically the org/apache/maven/plugins subfolder. (Plugins are organized according to a directory structure that resembles the standard Java package naming convention)

13.3. Offline Repository for a Maven Project Red Hat JBoss Fuse 6.1 , [ERROR] Plugin org.apache.maven.plugins:maven-resources-plugin:2.7 or one of its dependencies could not be resolved: Failed to read� org.apache.maven.plugins » maven-dependency-plugin Apache Provides utility goals to work with dependencies like copying, unpacking, analyzing, resolving and many more. Last Release on Mar 11, 2020

Comments
  • Have you've found a reason responsible for this strange behavior?
  • Personally I suspect this "issue" can be related to Maven's "Plugin Prefix Resolution", maven.apache.org/guides/introduction/….
  • This is a good point, but my idea is to create a kind of CD/DVD with the procedures to create a war file, with MVN in this example. By that I create a 'file' repository, that contains all dependencies that I need. With your idea I'll have to force the user to put all dependencies into his .m2 dir. This is a option, but I'm running to some other direction.
  • It doesn't download plugin dependencies (plugins themselves downloaded but dependent jars are missing) in mvn 3.5.0. Whenever I try to compile with mvn install -o it throws error that dependency has not been downloaded.
  • Did you just try to running a build, mvn install, before going offline? I believe that should fetch the plugins and plugin dependencies.
  • @Rich, when you mention in specify the version of my plugins you are saying MAVEN plugins right? Which is the best way to do this specification ?? Please see my update in my post to see if I'm doing right. Thanks!