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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:30:28+00:00 2026-05-15T20:30:28+00:00

Is there a way ( I mean how do I ) set a system

  • 0

Is there a way ( I mean how do I ) set a system property in a maven project?

I want to access a property from my test and my webapp ( running locally ) and I know I can use a java system property.

Should I put that in ./settings.xml or something like that?

Context

I took an open source project and managed to change the db configuration to use JavaDB

Now, in the jdbc url for JavaDB, the location of the database could be specified as the full path ( see: this other question )

Or a system property: derby.system.home

I have the code working already, but currently it is all hardcoded to:

 jdbc:derby:/Users/oscarreyes/javadbs/mydb

And I want to remove the full path, to leave it like:

 jdbc:derby:mydb

To do that I need to specify the system property ( derby.system.home ) to maven, but I don’t know how.

The test are performed using junit ( I don’t see any plugin in pom.xml ) and the web app runs with the jetty plugin.

Specifying the system property in the command line seems to work for jetty, but I’m not sure if that’s something practical ( granted some other users may run it from eclipse/idea/ whatever )

  • 1 1 Answer
  • 2 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-15T20:30:29+00:00Added an answer on May 15, 2026 at 8:30 pm

    Is there a way ( I mean how do I ) set a system property in a maven project? I want to access a property from my test […]

    You can set system properties in the Maven Surefire Plugin configuration (this makes sense since tests are forked by default). From Using System Properties:

    <project>
      [...]
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.5</version>
            <configuration>
              <systemPropertyVariables>
                <propertyName>propertyValue</propertyName>
                <buildDirectory>${project.build.directory}</buildDirectory>
                [...]
              </systemPropertyVariables>
            </configuration>
          </plugin>
        </plugins>
      </build>
      [...]
    </project>
    

    and my webapp ( running locally )

    Not sure what you mean here but I’ll assume the webapp container is started by Maven. You can pass system properties on the command line using:

    mvn -DargLine="-DpropertyName=propertyValue"
    

    Update: Ok, got it now. For Jetty, you should also be able to set system properties in the Maven Jetty Plugin configuration. From Setting System Properties:

    <project>
      ...
      <plugins>
        ...
          <plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>maven-jetty-plugin</artifactId>
            <configuration>
             ...
             <systemProperties>
                <systemProperty>
                  <name>propertyName</name>
                  <value>propertyValue</value>
                </systemProperty>
                ...
             </systemProperties>
            </configuration>
          </plugin>
      </plugins>
    </project>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to set a default position for a UIPicker? I mean,
Is there a Pythonic way (I mean, no pure SQL query) to define an
Is there a way to evaluate the minimum requirements of a software? I mean,
Is there any way to get the date January 1, 1970 Greenwich Mean Time
is there any way to detect device with xcode ? i mean when my
Is there a way to detect locked tables in MySQL? I mean tables locked
Is there a good scala-esque (I guess I mean functional) way of recursively listing
Is there a simple way to have isometric projection? I mean the true isometric
Is there way to get file from windows xp command prompt? I tried to
By the traditional way I mean registering the DLL in registry. There seems to

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.