0

I would like to build and deploy my war file directly to the domain of appserver. The below snippet is working fine for this,

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${version.maven.war.plugin}</version>
<configuration>
<outputDirectory>
C:\Program Files\glassfish\glassfish5\glassfish\domains\domain1\autodeploy
</outputDirectory>
</configuration>
</plugin>

I don't want to hard code the path. So, I set the system variable GLASSFISH_HOME : C:\Program Files\glassfish and used it in the POM file like this:

<outputDirectory>                    
 ${GLASSFISH_HOME}\glassfish5\glassfish\domains\domain1\autodeploy
</outputDirectory>

but its not working. maven is creating a directory in the current path of the project like below:

[INFO] Building war: C:\Workspaces\Workspace- Restful\moviedirectory\${GLASSFISH_HOME}\glassfish5\glassfish\domains\domain1\autodeploy\moviedirectory.war

any suggestions how to avoid hard coding path but deploy the war to appserver while building it with maven?

Johnyzhub
  • 382
  • 2
  • 4
  • 18

1 Answers1

1

Have a look at How to refer environment variable in POM.xml?

So the following should do what you want.

<outputDirectory>                    
  ${env.GLASSFISH_HOME}\glassfish5\glassfish\domains\domain1\autodeploy
</outputDirectory>
wirnse
  • 1,026
  • 8
  • 7