Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test and add new env variable property #3

Closed
wants to merge 6 commits into from
Closed

Fix test and add new env variable property #3

wants to merge 6 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Sep 30, 2017

This handles issue #1 and #2

Copy link
Owner

@haroon-sheikh haroon-sheikh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Takias thanks for the PR.

Can you please explain what the changes are?

From what I can understand, pom is now going to read properties from env/default.properties.

However, I'm looking to read properties within java code instead and if a properties is assigned to an environment variable example.property=${JAVA_HOME} for example, then example.property should output JAVA_HOME value. i.e. that's using System.getenv('JAVA_HOME') instead of System.getProperty('JAVA_HOME'). I hope this clarifies the requirements.

@ghost
Copy link
Author

ghost commented Oct 1, 2017

@haroon-sheikh I have added an example in the properties file which reads the PATH environment variable. Maven reads this from properties file and sets as a system property. See the pom.xml where the following section adds the system properties.

<configuration>
	<systemPropertyVariables>
		<my.Property>${property.package}</my.Property>
		<her.Property>${property.version}</her.Property>
		<my.pathvar>${pathvar}</my.pathvar>
	</systemPropertyVariables>
</configuration>

Then you can access the property using for e.g. System.getProperty("my.pathvar")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant