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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T06:45:06+00:00 2026-05-23T06:45:06+00:00

In my Maven build I would like to be able to define default values

  • 0

In my Maven build I would like to be able to define default values (e.g. for database connection) in pom.xml, but I would like the user to be able to override these without having to modify pom.xml directly.

By way of example, in an Ant build you can define default properties in foo.properties, but Ant will look for overrides for each of these in a foo.$USERNAME.properties. The latter is generally not checked into source control, which eliminates the problem of developers accidentally committing their overrides of the default properties. Does Maven offer a similar facility?

To make the problem a bit more concrete, assume I have the following defined in pom.xml

<properties>
  <db.url>jdbc:jtds:sqlserver://10.10.10.10:1433/somedb</db.url>
  <db.driver>net.sourceforge.jtds.jdbc.Driver</db.driver>
  <db.username>default_user</db.username>
  <db.password>secret</db.password>
</properties>

Can a user override these properties without editing the pom.xml directly?

  • 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-23T06:45:06+00:00Added an answer on May 23, 2026 at 6:45 am

    You can specify properties on the command line using -Dpropertyname=value, or the user can specify properties in their .m2/settings.xml.

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

Sidebar

Related Questions

I would like to be able to, as part of a maven build, set
I'm using the build-helper-maven-plugin to add it to my build, but I'd like to
I would like to be able to publish snapshots to the repository using maven
What would you suggest as a replacement to the Maven Java build toolset? Just
I would like to take advantage of the features that Maven provides for managing
We build software using Hudson and Maven. We have C#, java and last, but
I'd like my Maven build to fail if the same artifact is referenced with
I am using maven and would like to have it show all errors on
I would like to know,If there is a Hudson plugin to reduce the build
I would like to run a main method using Maven's exec command. I can

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.