Note that there are some explanatory texts on larger screens.

plurals
  1. PODoes the maven-dependency-plugin use some other kind of artifact resolution than the rest of maven?
    text
    copied!<p>If I use the maven-dependency-plugin plugin, than I can't use a version range. Also it seems the version of a there defined artifact doesn't get updated though a newer version is in the remote repository.</p> <p>Why is that so?</p> <p>Uses the maven-dependency-plugin some other mechanism than the rest of maven to resolve dependencies? And if that is the case, why?</p> <p><strong>Here a example:</strong></p> <p>I have created a project <em>org.example:org.example.simple.project1:jar</em> and put it in the repository using the versions <em>1.0.0-SNAPSHOT, 1.0.0, 1.0.1</em> and <em>1.1.0-SNAPSHOT</em></p> <p>I have now configured the dependency plugin in the following way:</p> <pre><code>&lt;plugin&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-dependency-plugin&lt;/artifactId&gt; &lt;executions&gt; &lt;execution&gt; &lt;id&gt;unpack-stuff&lt;id&gt; &lt;phase&gt;initialize&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;unpack&lt;/goal&gt; &lt;/goals&gt; &lt;configuration&gt; &lt;artifactItems&gt; &lt;artifactItem&gt; &lt;groupId&gt;org.example&lt;/groupId&gt; &lt;artifactId&gt;org.example.simple.project1.&lt;/artifactId&gt; &lt;version&gt;[1.0,1.1)&lt;/version&gt; &lt;type&gt;jar&lt;/type&gt; &lt;overWrite&gt;true&lt;/overWrite&gt; &lt;outputDirectory&gt;target/stuff&lt;/outputDirectory&gt; &lt;includes&gt;**/*.*&lt;/includes&gt; &lt;/artifactItem&gt; &lt;/artifactItems&gt; &lt;/configuration&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; </code></pre> <p>If the dependency resolution would be the same as in the other dependencies, the version shoud resolve (at least in my opinion) to <strong>1.0.1</strong>.</p> <p>Instead I get the following exception:</p> <pre><code>[ERROR] FATAL ERROR [INFO] ------------------------------------------------------------------------ [INFO] version was null for org.example:org.example.simple.project1. [INFO] ------------------------------------------------------------------------ [INFO] Trace java.lang.NullPointerException: version was null for org.example:org.example.simple.project1. at org.apache.maven.artifact.DefaultArtifact.getBaseVersion(DefaultArtifact.java:362) at org.apache.maven.artifact.repository.layout.DefaultRepositoryLayout.pathOf(DefaultRepositoryLayout.java:47) at org.apache.maven.artifact.repository.DefaultArtifactRepository.pathOf(DefaultArtifactRepository.java:110) at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:125) at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:74) at org.apache.maven.plugin.dependency.fromConfiguration.AbstractFromConfigurationMojo.getArtifact(AbstractFromConfigurationMojo.java:242) at org.apache.maven.plugin.dependency.fromConfiguration.AbstractFromConfigurationMojo.getProcessedArtifactItems(AbstractFromConfigurationMojo.java:143) at org.apache.maven.plugin.dependency.fromConfiguration.UnpackMojo.getProcessedArtifactItems(UnpackMojo.java:138) at org.apache.maven.plugin.dependency.fromConfiguration.UnpackMojo.execute(UnpackMojo.java:88) at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:453) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:559) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:500) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:479) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:331) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:292) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129) at org.apache.maven.cli.MavenCli.main(MavenCli.java:301) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315) at org.codehaus.classworlds.Launcher.launch(Launcher.java:255) at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430) at org.codehaus.classworlds.Launcher.main(Launcher.java:375) [INFO] ------------------------------------------------------------------------ [INFO] Total time: 4 seconds [INFO] Finished at: Mon Aug 03 17:21:41 CEST 2009 [INFO] Final Memory: 13M/133M [INFO] ------------------------------------------------------------------------ </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload