willy
willy

Reputation: 255

run main java from Intellij but should ready system properties set in pom.xml

How do i run normal main java but the system properties should be set through profile in pom.xml

i can get this work if i run junit test but not main java

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

I believe this is due to fact the systemPropertiesVariables set for maven-surefire-plugin.

Upvotes: 0

Views: 306

Answers (1)

J Fabian Meier
J Fabian Meier

Reputation: 35843

You cannot set system Properties for running a Java program through Maven.

Maven only sets properties for the build (and the tests). Invoking the program after build is a completely different thing.

Upvotes: 1

Related Questions