Passing the selected maven profile/value to java

in this post we will pass the selected env value to the java file.  when you start the project as follows: -Denv=asseco-test pom.xml <profiles> <profile> <id>asseco-test</id> <activation> <activeByDefault>true</activeByDefault> <property> <name>asseco-env</name> <value>asseco-test</value> </property> </activation> <properties> <profile-id>asseco-test</profile-id> </properties> </profile> <profile> <id>asseco-prod</id> <activation> <activeByDefault>false</activeByDefault> <property> <name>asseco-env</name> <value>asseco-prod</value> </property> </activation> <properties> <profile-id>asseco-prod</profile-id> </properties> </profile> </profiles> java file private Properties

One jar with all dependencies

The configuration is below when you issue this command “mvn clean package assembly:single” then you will get a jar file containing all the sources and if  you check the me MANIFEST.MF file and you will see the line “Main-Class: com.tugrulaslan.App” the value we set below in the pom.xml <project xmlns=”http://maven.apache.org/POM/4.0.0″ xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=”http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd”> <modelVersion>4.0.0</modelVersion> <groupId>de.goeuro</groupId>

Maven goals

validate – validate the project is correct and all necessary information is available compile – compile the source code of the project test – test the compiled source code using a suitable unit testing framework. These tests should not require the code be packaged or deployed package – take the compiled code and package it in its distributable format,