Note that there are some explanatory texts on larger screens.

plurals
  1. POMaven and Multiple Goals
    primarykey
    data
    text
    <p>I'm attempting to use the Grails Maven plugin to build a war file. There's a known problem with the plugin in that it does not resolve range dependencies, and my project pom file must contain range dependencies. </p> <p>The dependency is specified like this:</p> <pre><code>&lt;dependency&gt; &lt;groupId&gt;mygroup&lt;/groupId&gt; &lt;artifactId&gt;myartifact&lt;/artifactId&gt; &lt;version&gt;[0.0.0,999.999.999)&lt;/version&gt; &lt;/dependency&gt; </code></pre> <p>The error message is like this:</p> <blockquote> <p>[ERROR] Failed to execute goal org.grails:grails-maven-plugin:2.2.1:clean (default-clean) on project sdm: Failed to create classpath for Grails execution. Encountered problems resolving dependencies of the executable in preparation for its execution. Error resolving project artifact: Could not transfer artifact mygroup.myartifact:pom:[0.0.0,999.999.999) from/to myRepo (<a href="https://maven.mydomain/nexus/content/groups/myRepo" rel="nofollow">https://maven.mydomain/nexus/content/groups/myRepo</a>): IllegalArgumentException for project mygroup.myartifact:pom:[0.0.0,999.999.999): Illegal character in path at index 89: https://maven.mydomain/nexus/content/groups/myRepo/mygroup/myartifact/[0.0.0,999.999.999)/myartifact-[0.0.0,999.999.999).pom -> [Help 1]</p> </blockquote> <p>As you can see, the range dependency is not being resolved, and a literal version "[0.0.0,999.999.999)" is being looked for.</p> <p>To work around the problem, I can use the Maven version plugin and do this:</p> <ol> <li>mvn versions:resolve-ranges <em>[replaces range deps in pom file with actual versions]</em></li> <li>mvn grails:war <em>[builds war based on actual versions in newly modified pom file]</em></li> <li>mvn versions:revert <em>[reverts pom file to original state]</em></li> </ol> <p><strong>BUT</strong> here's my problem: if I combine these goals into one Maven command:</p> <pre><code>mvn versions:resolve-ranges grails:war versions:revert </code></pre> <p>the grails:war fails with the error I described above - it seems to be seeing the pom file in its initial state (with the range dependencies), even though the versions plugin has updated the pom file with actual version numbers. After the failure, the pom file has this:</p> <pre><code>&lt;dependency&gt; &lt;groupId&gt;mygroup&lt;/groupId&gt; &lt;artifactId&gt;myartifact&lt;/artifactId&gt; &lt;version&gt;2.1.15&lt;/version&gt; &lt;/dependency&gt; </code></pre> <p>So my question is - why does the second goal (grails:war) see the pom file as it was at the start of the whole chain of goals, not as it is when the goal runs? How can I make the second goal (grails:war) see the pom file as it stands after completion of the first goal (versions:resolve-ranges)?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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