Note that there are some explanatory texts on larger screens.

plurals
  1. POXML maven artifact not on classpath
    primarykey
    data
    text
    <p>I have some external configuration (XML files) that are installed in Maven. I need to have them on my test classpath but they aren't appearing.</p> <p>They must stay as XML, I cannot package them inside a Jar - but I am willing to try anything else for this, custom plugin etc.</p> <p>(Please don't inform me that Maven is only for Jars - that's simply not true (and if you provide a reference refuting that I can assure you it's out-of-date/misinformation).</p> <p>The dependencies are specified thus:</p> <pre><code> &lt;dependency&gt; &lt;groupId&gt;some.group&lt;/groupId&gt; &lt;artifactId&gt;some.artifact&lt;/artifactId&gt; &lt;version&gt;${project.version}&lt;/version&gt; &lt;scope&gt;test&lt;/scope&gt; &lt;type&gt;xml&lt;/type&gt; &lt;classifier&gt;some.classifier&lt;/classifier&gt; &lt;/dependency&gt; </code></pre> <p>These XML artifacts have been created by the build-helper plugin (so there's no 1-2-1 with their project's POM).</p> <p>My only current hacky solution is to, check for the M2_HOME property and load the files from there (as they're defined as dependencies Maven does pull them down) - but I'm not happy with this.</p> <p><strong>EDIT</strong>: The next best hack is probably to use the maven-dependency-plugin to copy these to the output directory (target/classes). If my config is fine for Jars then this smells like a Maven bug.</p> <p><strong>EDIT 2</strong>: @khmarbaise asked for the build-helper-plugin config:</p> <pre><code> &lt;plugin&gt; &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt; &lt;artifactId&gt;build-helper-maven-plugin&lt;/artifactId&gt; &lt;executions&gt; &lt;execution&gt; &lt;id&gt;attach-artifacts&lt;/id&gt; &lt;phase&gt;package&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;attach-artifact&lt;/goal&gt; &lt;/goals&gt; &lt;configuration&gt; &lt;artifacts&gt; &lt;artifact&gt; &lt;file&gt;target/classes/ddl-seed.xml&lt;/file&gt; &lt;type&gt;xml&lt;/type&gt; &lt;classifier&gt;ddl-seed&lt;/classifier&gt; &lt;/artifact&gt; &lt;!-- ... more definitions --&gt; </code></pre> <p>This generates the correct maven-metadata-local.xml data for all the XML artifacts.</p>
    singulars
    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.
 

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