Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8233653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T18:12:12+00:00 2026-06-07T18:12:12+00:00

I have some external configuration (XML files) that are installed in Maven. I need

  • 0

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.

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.

(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).

The dependencies are specified thus:

    <dependency>
        <groupId>some.group</groupId>
        <artifactId>some.artifact</artifactId>
        <version>${project.version}</version>
        <scope>test</scope>
        <type>xml</type>
        <classifier>some.classifier</classifier>
    </dependency>

These XML artifacts have been created by the build-helper plugin (so there’s no 1-2-1 with their project’s POM).

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.

EDIT: 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.

EDIT 2: @khmarbaise asked for the build-helper-plugin config:

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <executions>
                <execution>
                    <id>attach-artifacts</id>
                    <phase>package</phase>
                    <goals>
                        <goal>attach-artifact</goal>
                    </goals>
                    <configuration>
                        <artifacts>
                            <artifact>
                                <file>target/classes/ddl-seed.xml</file>
                                <type>xml</type>
                                <classifier>ddl-seed</classifier>
                            </artifact>
                            <!-- ... more definitions -->

This generates the correct maven-metadata-local.xml data for all the XML artifacts.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T18:12:14+00:00Added an answer on June 7, 2026 at 6:12 pm

    Unfortunately I can find no way of forcing maven to add the test dependency specified to the test classpath, other than this stinky hack of copying it to a directory on the test classpath.

    This seems the quickest way (it’s for a test dependency), avoiding any JAR creation.

                <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack</id>
                        <phase>generate-test-resources</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>com.acme.gid</groupId>
                                    <artifactId>com.acme.aid</artifactId>
                                    <version>${project.version}</version>
                                    <classifier>ddl</classifier>
                                    <type>xml</type>
                                    <outputDirectory>${project.build.directory}/test-classes</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some external header files in a separate directory (its the sqlite3.h). I
I have some data from a external party which is encrypted according to them
I have to download some data from external source but I have to submit
I have external html5 canvas that you can paint on some lines using your
I have a swing application that uses some datas coming from an external mysql
Grails 1.3.7 I have some configuration located in an external config file. One of
I have some external services. My Django app is built on top of my
I have user (not administrator) access to some external JMS. I'm failing to view
I have an external setting file which has some nodes holiding attribute values of
I have an external file with some vars to require in my php class

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.