Eclipse - maven - what goal should I execute to ac

2019-02-20 03:01发布

问题:

New to maven - I have an eclipse project that I can Right click > Run as... > Run on server and it runs successfully on my local Wildfly installation. Is there a way to RClick> Run as... and choose an appropriate maven goal to achieve the same effect (ie package as a war, copy to the servers dir (re)staring the server) ? Do I need to use a "wildfly maven plugin" ?

Similar question for tomcat: maven deploy goal failing

I am on eclipse Luna Java EE pack, maven 3.1 (the one that comes with eclipse) and using Wildfly 8.1.0.Final

Related:

  • One click build and deploy using Eclipse/Maven/JBoss AS 7

EDIT: I am now on Wildfly - so I edited accordingly

The closest I got was:

<plugin>
    <groupId>org.wildfly.plugins</groupId>
    <artifactId>wildfly-maven-plugin</artifactId>
    <version>1.0.2.Final</version>
    <configuration>
        <jbossHome>C:/_/wildfly-8.1.0.Final</jbossHome>
    </configuration>
</plugin>

but I would like to avoid hardcoding the path there - how should I proceed ?

回答1:

You can use jboss plugin

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

Then set goal as: “jboss-as:deploy clean”

It will deploy war on JBoss server.