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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T08:39:50+00:00 2026-06-16T08:39:50+00:00

How can i set up an environment variable (in other words internally accessible by

  • 0

How can i set up an environment variable (in other words internally accessible by System.getenv("APP_HOME") in a pom file?

APP_HOME=/path/home

I realize i can set it up in .profile, but wonder if pom can do the same trick.

Per bmargulies’s suggestion below, i tried the following, without luck

<build>
    <finalName>KvpStore</finalName>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
                <encoding>UTF-8</encoding>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.12.4</version>
            <configuration>
                <includes>
                    <include>**/*Test*.java</include>
                </includes>
                <environmentVariables>
                    <APP_NAME>blah_blah</APP_NAME>  <------------------------
                </environmentVariables>
            </configuration>
        </plugin>
    </plugins>
</build>
  • 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-16T08:39:52+00:00Added an answer on June 16, 2026 at 8:39 am

    The documentation of the maven-surefire-plugin show examples and describes how to do such things of setting up system properties.

    <configuration>
      <systemPropertyVariables>
        <propertyName>propertyValue</propertyName>
        <buildDirectory>${project.build.directory}</buildDirectory>
        [...]
      </systemPropertyVariables>
    </configuration>
    

    It might be better to use them instead of environment variable, cause it’s simpler to use them, cause env variable needed to setup correctly and the cmd.exe and the jvm must be restarted to get them working.

    It is not necessary to configure the includes for the tests, cause maven-surefire-plugin has already the following defaults:

    <includes>
     <include>**/Test*.java</include>
     <include>**/*Test.java</include>
     <include>**/*TestCase.java</include>
    </includes>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I assume that MAMP environment variables can be set in ~/.bash_profile, but it seems
How can developers set up their environment paths when working on different SVN branches
I can not get environment at custom target shell. CMakeList.txt set( ENV{TEST_VAR} Hello )
How can I can set a global variable for the username of the logged-in
In R, I can set environment variables manually, for example: Sys.setenv(TODAY = Friday) But
I'm writing a simple script to substitute text in an environment variable with other
I want to detect an environment variable outside of Xcode's settings. I can do
Sencha Cmd using Compass.app for Windows, what is the Environment Variable PATH - to
I can set the width and height of my canvas by setting the width
I can set the relationship between View Model and view through following DataContext syntax:

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.