Install war file in server deployment directory

I want the war file to be deployed to the server deployment directory (or any other directory of my choice) along with the one deployed to the repository. Also, can I control the name of the war file deployed as, I don't want the war file to be projectname-1.0.war. I just need the war file name to be projectname.war.

Thank,

Ravi

+2


source to share


4 answers


Thanks guys,

I got it working. here's what i did.

I added this to my pom.xml file

<build>
<plugins>
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <configuration>
            <warName>mavenproject1</warName>
            <outputDirectory>C:\jboss-5.1.0.GA\server\default\deploy</outputDirectory>
        </configuration>
    </plugin>

</plugins>

      



This solved both my naming and war file placement.

Ravi

+8


source


The first option would be to use the JBoss Maven Plugin which allows you to start / stop JBoss and deploy / deploy applications via JMX.

Your config should set a location in your JBoss Home directory. This can be done by setting the tagged home directory jbossHome

in the plugin config:

<project>
  ...
  <build>
    <defaultGoal>package</defaultGoal>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>jboss-maven-plugin</artifactId>
        <configuration>
          <jbossHome>C:/jboss-5.1.0.GA</jbossHome>
        </configuration>
      </plugin>
      ...
    </plugins>
    ...
  </build>
  ...
</project>

      

Then just use one of the specified targets here , for example:

$ mvn jboss:deploy

      




Another option would be to use the Cargo Maven Plugin . Below is an example of a plugin configuration that you can add to your war project:

<plugin>
  <groupId>org.codehaus.cargo</groupId>
  <artifactId>cargo-maven2-plugin</artifactId>
  <configuration>
    <wait>false</wait>
    <container>
      <containerId>jboss5x</containerId>
      <home>C:/jboss-5.1.0.GA</home>
    </container>

    <configuration>
      <type>existing</type>
      <properties>
        ...
      </properties>
    </configuration>
  </configuration>
<plugin>

      

Then, to deploy " deployable " (your war here) to a running container:

$ mvn cargo:deploy

      

+3


source


"Deploy" may sound very technical, but it is easy to copy it into the deployment directory. In some cases, you may need to restart the server.

+1


source


To change how the file is deployed, use a tag in the build section of your pom.xml to specify the package name.

http://maven.apache.org/plugins/maven-jar-plugin/sign-mojo.html

+1


source







All Articles