How to deploy WAR of Maven Project to JBoss server from Eclipse?

后端 未结 9 1547
太阳男子
太阳男子 2020-12-23 12:11

I want to deploy WAR of Maven project to JBoss server. I know that from Eclipse Export->War deploy the WAR file to JBoss. But How can I do this for Maven Project. Any step b

相关标签:
9条回答
  • 2020-12-23 12:50

    Simply adding below plugin to POM.xml worked for me.

    <build>
        ...
        <plugins>
            ...
            <plugin>
                <groupId>org.jboss.as.plugins</groupId>
                <artifactId>jboss-as-maven-plugin</artifactId>
                <version>7.9.Final</version>
            </plugin>
            ...
        </plugins>
        ...
    </build>
    

    Using command prompt one can deploy or undeploy the artifact.

      mvn jboss-as:redeploy
      mvn jboss-as:undeploy
    

    Note: The above option uses http://localhost:9999 url to deploy the artifact to server. The Jboss server should be running in background before the command is executed.

    Also one can use eclipse to execute above goals.

    Step 1: Click on run configuration.

    Step 2:Create a new Maven Build

    Step 3:Update build details as shown.

    More option can be found at

    https://docs.jboss.org/jbossas/7/plugins/maven/latest/examples/deployment-example.html

    0 讨论(0)
  • 2020-12-23 12:52
    <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
                <execution>
                    <id>copy-war</id>
                    <phase>install</phase>
                    <goals>
                        <goal>copy</goal>
                    </goals>
                    <configuration>
                        <artifactItems>
                            <artifactItem>
                                <groupId>${project.groupId}</groupId>
                                <artifactId>${project.artifactId}</artifactId>
                                <version>${project.version}</version>
                                <type>${project.packaging}</type>
                                <overWrite>true</overWrite>
                                <outputDirectory>C:\jboss-as-7.1.1.Final_AMGEN\jboss-as-7.1.1.Final\standalone\deployments</outputDirectory>
                                <destFileName>${project.build.finalName}.${project.packaging}</destFileName>
                            </artifactItem>
                        </artifactItems>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    

    here <outputDirectory>"containes address of deployment folder in Jboss"</outputDirectory> put the given code accordingly in pom.xml

    0 讨论(0)
  • 2020-12-23 12:57

    The correct format is:

    <fileName>${basedir}/target/webapp.war</fileName>
    
    0 讨论(0)
  • 2020-12-23 12:59

    Assumption

    I am assuming that you have already installed the plugins for Maven for eclipse.

    Installation

    While selecting the project in project explorer select Run --> Run As --> Maven Install

    Running Jboss

    1. Go to Run --> Run Configurations..

    2. Add new Maven Build

    3. Name the Process, Select the Base directory that will be deployed as war

    4. set the Goal --> jboss:start

    By following the steps you can deploy every thing via Eclipse.

    Have fun. :)

    0 讨论(0)
  • 2020-12-23 13:00

    Use the following goals to deploy your war in Jboss folder

    clean install jboss:hard-deploy
    
    0 讨论(0)
  • 2020-12-23 13:01

    Well http://cargo.codehaus.org/Maven2+plugin could be a nice alternative, too.

    0 讨论(0)
提交回复
热议问题