Eclipse Mars清理构建并将战争移至Jboss部署目录

时间:2017-11-07 09:27:49

标签: maven build jboss m2e

我正在使用带有maven集成插件的eclipse Mars并在Eclipse Mars中配置JBoss EAP 7.0服务器。

我遵循maven构建配置guide并成功构建并在目标目录中生成war。

这是可能的,使用maven build run> “clean install”在目标目录中创建一个新的project.war。同时,project.war将上传到%JBOSS_HOME%\ standalone \ deployments目录。我尝试同时绑定构建和导出过程。

我尝试在pom.xml中添加以下配置但不起作用。

<configuration>
    ....
    <webappDirectory>D:\jboss-eap-7.0.0\jboss-eap-7.0\standalone\deployments\</webappDirectory>
</configuration>

<configuration>
    ....
    <outputDirectoryD:\jboss-eap-7.0.0\jboss-eap-7.0\standalone\deployments\</outputDirectory>
</configuration>

<executions>
    <execution>
        <phase>install</phase>
        <configuration>
            <target>
               <copy file="D:\workspace\project\target\project.war"
                                    todir="D:\jboss-eap-7.0.0\jboss-eap-7.0\standalone\deployments\" />
            </target>
        </configuration>
        <goals>
            <goal>run</goal>
        </goals>
    </execution>
</executions>

结果:

[ERROR] Could not find goal 'run' in plugin org.apache.maven.plugins:maven-compiler-plugin:3.1 among available goals testCompile, compile, help -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoNotFoundException

1 个答案:

答案 0 :(得分:0)

经过几次尝试,我决定使用替代解决方案。 我需要什么基本上编译war文件并部署到Jboss服务器。

我按照以下方式编写批处理作业以存档相同的目标。 在我从Eclipse更改源代码后,我将运行此批处理作业以触发更改。

批量作业

SET WORKSPACE=D:\workspace\project\
SET JBOSS_DEPLOYMENT=D:\jboss-eap-7.0.0\jboss-eap-7.0\standalone\deployments\

cd /D %WORKSPACE%
echo %WORKSPACE%

call mvn clean package

xcopy /y %WORKSPACE%\target\*.war %JBOSS_DEPLOYMENT%

echo Move war from %WORKSPACE% to %JBOSS_DEPLOYMENT%

pause

此批处理作业将编译新的war文件并将war复制到JBoss部署目录,如果检测到任何war更新,服务器将自动进行热部署。