首页 文章

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

提问于
浏览
0

我正在使用带有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>

Result:

[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

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

    我写了一个批处理作业如下,以存档相同的目标 . 从Eclipse更改源代码后,我将运行此批处理作业以触发更改 .

    Batch Job

    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
    

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

相关问题