Hello, I'm currently developping a Maven plugin, and I have a problem if I use it in command line (but if I use it in a project, It works fine). I've got 'Failed to resolve artifact' error.
So I execute it with : mvn install:install-file homega.tools:obrPlugin:repository -Dfile= org.apache.felix.ipojo-0.7.1-incubator-SNAPSHOT.jar -DartifactId=ipojo -DgroupId=org.apache.felix -Dversion=0.7.1-incubator-SNAPSHOT-Dpackaging=jar In fact the specified file (here: org.apache.felix.ipojo-0.7.1-incubator-SNAPSHOT.jar) will be installed with groupId, artifactId and version given, then my plugin will be executed. So Maven tries to download all the dependencies used by my plugin, but instead of using the version and groupId specified in my plugin pom.xmlfile, it changes this two fields by groupId and version specified in command line. this is a part of my plugin pom.xml file: ... <dependency> <groupId>org.apache.felix</groupId> <artifactId>org.osgi.core</artifactId> <version>0.9.0-incubator-SNAPSHOT</version> <scope>provided</scope> </dependency> ... and the result of an execution: C:\projet\Stage>mvn install:install-file homega.tools:obrPlugin:repository-Dfile= org.apache.felix.ipojo-0.7.1 -incubator-SNAPSHOT.jar -DartifactId=ipojo -DgroupId=test -Dversion=0.7.7-Dpackaging=jar [INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'install'. [INFO] ---------------------------------------------------------------------------- [INFO] Building Unnamed - tools:ipojo:jar:0.7.1 [INFO] task-segment: [install:install-file] (aggregator-style) [INFO] ---------------------------------------------------------------------------- [INFO] [install:install-file] [INFO] Installing C:\projet\Stage\org.apache.felix.ipojo- 0.7.1-incubator-SNAPSHOT.jar to C:\projet\Stage\mvn_r epo\test\ipojo\0.7.7\ipojo-0.7.7.jar [INFO] ---------------------------------------------------------------------------- [INFO] Building Unnamed - tools:ipojo:jar:0.7.1 [INFO] task-segment: [homega.tools:obrPlugin:repository] [INFO] ---------------------------------------------------------------------------- Downloading: http://repo1.maven.org/maven2/test/org.osgi.core/0.7.7/org.osgi.core-0.7.7.pom Downloading: http://repo1.maven.org/maven2/test/org.osgi.core/0.7.7/org.osgi.core-0.7.7.pom Downloading: http://repo1.maven.org/maven2/test/org.apache.felix.shell/0.7.7/org.apache.felix.shell-0.7.7.pom Downloading: http://repo1.maven.org/maven2/test/org.apache.felix.shell/0.7.7/org.apache.felix.shell-0.7.7.pom Downloading: http://repo1.maven.org/maven2/test/org.osgi.core/0.7.7/org.osgi.core-0.7.7.jar Downloading: http://repo1.maven.org/maven2/test/org.apache.felix.shell/0.7.7/org.apache.felix.shell-0.7.7.jar [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] Failed to resolve artifact. Missing: ---------- 1) test:org.osgi.core:jar:0.7.7 Try downloading the file manually from the project website. Then, install it using the command: mvn install:install-file -DgroupId=test -DartifactId=org.osgi.core \ -Dversion=0.7.7 -Dpackaging=jar -Dfile=/path/to/file Path to dependency: 1) homega.tools:obrPlugin:maven-plugin:1.0.0 2) org.apache.felix:org.apache.felix.shell:jar:0.9.0-incubator-SNAPSHOT 3) test:org.osgi.core:jar:0.7.7 2) test:org.apache.felix.shell:jar:0.7.7 Try downloading the file manually from the project website. Then, install it using the command: mvn install:install-file -DgroupId=test -DartifactId= org.apache.felix.shell \ -Dversion=0.7.7 -Dpackaging=jar -Dfile=/path/to/file Path to dependency: 1) homega.tools:obrPlugin:maven-plugin:1.0.0 2) org.apache.felix:org.apache.felix.bundlerepository:jar:0.9.0-incubator-SNAPSHOT 3) test:org.apache.felix.shell:jar:0.7.7 ---------- 2 required artifacts are missing. But if I install my file in the same groupId and version than the dependencies (ie: org.apache.felix, 0.9.0-incubator-SNAPSHOT), it works fine. example: C:\projet\Stage>mvn install:install-file homega.tools:obrPlugin:repository-Dfile= org.apache.felix.ipojo-0.7.1 -incubator-SNAPSHOT.jar -DartifactId=ipojo -DgroupId=org.apache.felix-Dversion= 0.9.0-incubator-SNAPSHOT -Dpac kaging=jar [INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'install'. [INFO] ---------------------------------------------------------------------------- [INFO] Building Unnamed - tools:ipojo:jar:0.7.1 [INFO] task-segment: [install:install-file] (aggregator-style) [INFO] ---------------------------------------------------------------------------- [INFO] [install:install-file] [INFO] Installing C:\projet\Stage\org.apache.felix.ipojo- 0.7.1-incubator-SNAPSHOT.jar to C:\projet\Stage\mvn_r epo\org\apache\felix\ipojo\0.9.0-incubator-SNAPSHOT\ipojo- 0.9.0-incubator-SNAPSHOT.jar [INFO] ---------------------------------------------------------------------------- [INFO] Building Unnamed - tools:ipojo:jar:0.7.1 [INFO] task-segment: [homega.tools:obrPlugin:repository] [INFO] ---------------------------------------------------------------------------- [INFO] [obrPlugin:repository] [INFO] Obr Plugin starts: [WARNING] -DpathRepo is not define, use default repository: file:/C:\projet\Stage\mvn_repo\repository.xml [WARNING] obr.xml is not present, use default [INFO] try to open: /C:/projet/Stage/mvn_repo/repository.xml [WARNING] pom property override:<presentationname> Unnamed - tools:ipojo:jar:0.7.1 [WARNING] pom property override:<version> 0.7.1 [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ So I don't understand how maven resolves the plugin dependencies, thank you for your response.