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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:42:00+00:00 2026-05-25T00:42:00+00:00

In a maven project I have several modules which only have a persitence.xml for

  • 0

In a maven project I have several modules which only have a persitence.xml for unit-tests in

src/test/resources/META-INF/persistence.xml

If I build the project with ‘package’ the (unit-test) persistence.xml is copied into the jar file.

The created artifact (jar) is not supposed to have any persistence.xml because it is already contained in a war file which includes several modules.

The poms are very small and have no plugins configured, everything should be the default behaviour.

  • What am I doing wrong?
  • Is there any documentation available which explains this effect?
  • 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-05-25T00:42:00+00:00Added an answer on May 25, 2026 at 12:42 am

    When you run Maven with the debug flag, i.e. mvn -X ... do you see any messages indicating that files from src/test are being copied? If so, you might want to check the Maven goal that performs this activity.

    Also, you might want to check the contents of the target/classes and target/test-classes directories of the project/module after the Maven build. Assuming that the module has a packaging of jar, the maven-jar-plugin merely picks up the contents of the project’s output directory, i.e. target/classes or ${project.build.outputDirectory} while carefully avoiding the project’s test output directory, i.e. target/test-classes or ${project.build.testOutputDirectory}. This should also be evident from the output of mvn -X ....

    Finally, you might want to check the contents of your local Maven repository for the jar file created. It might so happen that your maven-war-plugin used to create the WAR file,
    might be picking an older and incorrect version of the JAR that has the test persistence bundled in it, from the local repository.

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

Sidebar

Related Questions

I have a project with several modules. When all tests pass, Maven test runs
I have a maven project with the following packages (for illustration only): Root: src/main/java
I have maven project that consists of several modules. I want to add an
I have several Maven modules with Vaadin library dependency in the root pom.xml file.
I'm developing a maven project with several modules in eclipse. The parent pom.xml declares
I have a Maven project that consists of several modules. I have a single
I have a Spring project that uses Maven and has several profiles to allow
I have a multi-module maven project (several levels of nesting). Normally, when I execute
I have a maven2 project with several jar modules, build the project will get
I have a maven project which uses the shade plugin to create a jar

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.