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

  • Home
  • SEARCH
  • 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 8429275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:17:25+00:00 2026-06-10T05:17:25+00:00

I am in reference to Maven: The Complete Reference and especially the section regarding

  • 0

I am in reference to “Maven: The Complete Reference” and especially the section regarding profiles which documents the use of a <properties... tag within the <profile... tag here: see here

 <profile>
            <id>development</id>
            <activation>
                <activeByDefault>true</activeByDefault>
                <property>
                    <name>environment.type</name>
                    <value>dev</value>
                </property>
            </activation>
            <properties>
                <database.driverClassName>com.mysql.jdbc.Driver</database.driverClassName>
                <database.url>
                    jdbc:mysql://localhost:3306/app_dev
                </database.url>
                <database.user>development_user</database.user>
                <database.password>development_password</database.password>
            </properties>
        </profile>

What I am not sure about is what happens when the mvn install -Denvironment.type=dev command is run:

  • Will this create a .properties file?
  • If not how and where will tomcat (for instance) read the individual properties when the app is tested in dev?
  • 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-10T05:17:27+00:00Added an answer on June 10, 2026 at 5:17 am

    Will this create a .properties file?

    No, it won’t. This would set the properties used by maven. This is, with mvn install -Denvironment.type=development maven would use the value ‘development_user’ for the variable ‘database.user’ (that you can use as ${database.user} in poms and filtered resources).

    If not how and where will tomcat (for instance) read the individual properties when the app is tested in dev?

    The thing is to tell maven to filter (and modify) the resources that you want to customize depending on the profile (properties.files).

    So, first you have to say maven to filter the resources:

    <build>
        <resources>
            <resource>
                 <directory>src/main/resources</directory>
                 <filtering>true</filtering>
            </resource>
        </resources> 
    </build>
    

    Then modify your properties files to use maven variables. For example, your db properties file would look like this:

    database.driverClassName=${database.driverClassName}
    database.url=${database.url}
    #...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a maven project which won't compile due to an unresolvable reference from
i am new to maven and came across the resources section. The reference for
Is it possible to reference maven properties (artifactId, groupId, etc) outside of the pomfile?
Ive got a Maven project ive inherited which has no profiles setup, however I
I have a source repository for which I use maven. Usually I want to
Problem with Maven Dependency. Hello All, This is in reference to my earlier post
When writing a Maven plugin, you can configure various parameters within the mojo class,
Normally, to use a Maven plugins during the build, it needs to be explicitly
Most Hibernate tutorials use Maven for handling the build, but I'm looking for a
I am trying to use the Maven assembly plugin to build a jar-with-dependencies, except

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.