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 8385255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:37:23+00:00 2026-06-09T17:37:23+00:00

I have a multi-module maven project like this: -project +-sub-project1 +-sub-project2 For my JUnit

  • 0

I have a multi-module maven project like this:

-project
+-sub-project1
+-sub-project2

For my JUnit tests, I create another persistence.xml file inside the sub-project1/src/test/resources/META-INF. This project is a dependency for the sub-project2, in this way, I was hopping that the tests of sub-project2 use the same test persistence.xml from sub-project1, but it not happen.

So, I was wondering why I can made maven automatically copy this file to the other submodules during the test phase… maybe it’s better if I put this file in the project/resources folder, e.g., and then copy them…

I was hopping that someone already managed this to work somehow, and can help me or show how to do this.

Thanks in advance.

  • 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-09T17:37:25+00:00Added an answer on June 9, 2026 at 5:37 pm

    I managed it to work like this:

    I create a project/assembly/test/resources/META-INF/persistence.xml file, and add this to my pom.xml:

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <executions>
            <execution>
                <id>copy-test-persistence-xml-resources</id>
                <phase>process-test-sources</phase>
                <goals>
                    <goal>copy-resources</goal>
                </goals>
                <configuration>
                    <outputDirectory>src/</outputDirectory>
                    <resources>
                        <resource>
                            <directory>${project.parent.basedir}/assembly/</directory>
                            <filtering>true</filtering>
                        </resource>
                    </resources>
                </configuration>
            </execution>
        </executions>
    </plugin>
    

    It works gracefullt.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using soapUI maven plugin to create a multi-module maven-soapUi project. I have
I have a multi module maven project and I would like to use versions
I have a big multi-module Maven project with thousands of tests. Each test loads
I have a multi-module Maven project, and I would like to assemble together artifacts
I have a multi-module maven project made up of three sub-modules: web , service
I have a multi module project like this: gwt-app model webapp (depends on gwt-app
I have a multi-module maven project with an installer sub-project. The installer will be
I have a multi module maven project which looks something like: main component_one subcomponent_bob
I have a maven multi-module project. In one module, we create 2 ZIP files
I have a multi-module Maven project with a parent project P and three sub-modules

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.