首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >野生蝇Maven插件+热部署

野生蝇Maven插件+热部署
EN

Stack Overflow用户
提问于 2015-08-11 13:57:14
回答 2查看 2.5K关注 0票数 0

我有一个Java应用程序,配置在Eclipse中,我正在运行Wildfly 9和with in Eclipse。我使用通配符maven-plugin部署到服务器。

以下是我所遵循的步骤:

从eclipse启动服务器并执行Maven构建,这也会将应用程序部署到服务器。我可以在服务器上看到大量的“成功部署”日志,并且可以在浏览器中访问我的应用程序。它在“/独立/数据/内容”下创建一个文件夹,但在“独立/部署”下没有战争或爆发战争。

如果我更改了一些代码并将其保存在eclipse中(我选中了自动发布复选框并在保存的基础上构建),服务器日志显示:将部署"myApp.war“替换为从”独立\数据\内容“位置删除的部署"myApp.war”内容.

我看到在步骤1中创建的prev文件夹被删除,myApp.war被添加到部署文件夹中。但是现在我不能在浏览器中访问我的应用程序。

代码语言:javascript
复制
auto-deploy-exploded="true"

这是在standalone.xml的部分。

EN

回答 2

Stack Overflow用户

发布于 2015-08-12 15:26:52

对于Eclipse,您可以使用JBoss工具插件:http://tools.jboss.org/

票数 1
EN

Stack Overflow用户

发布于 2021-05-13 23:59:32

Wildfly有管理REST支持。不用花哨的工具。

这里是一个野蝇和玻璃鱼自动重新部署Maven项目的BASH脚本,即。在Eclipse中使用自动编译时:

代码语言:javascript
复制
set -x

pubname=$1
usewar=$2
if [[ -z $pubname ]]; then
    pubname=ROOT
fi
if [[ -z "$usewar" ]]; then
    usewar=0
else
    usewar=1
fi
if ! webappdir=$(ls -d `pwd`/target/*-SNAPSHOT); then
    webappdir=$(pwd)
fi
iswildfly=0

ctxroot="/$pubname"
if [[ "$pubname" == "ROOT" ]]; then
    ctxroot="/"
fi

port=4848
if curl http://localhost:9991/ ; then
    port=9991
    iswildfly=1
elif curl http://localhost:9990/ ; then
    port=9990
    iswildfly=1
fi

if (( usewar )); then
    webappdir=$webappdir.war
    if ! (( iswildfly )); then
        webappdir="@"$webappdir
    fi
fi

wildflycmd() {
    local cmd=$1
    curl --retry 100 --retry-delay 3 --retry-connrefused --digest -L -u admin:admin -D - http://localhost:$port/management \
        --header "Content-Type: application/json" \
        -d "$cmd"
}

if (( iswildfly )); then
    wildflycmd '{"operation" : "composite", "address" : [], "steps" : [{"operation" : "undeploy", "address" : {"deployment" : "'$pubname'.war"}},{"operation" : "remove", "address" : {"deployment" : "'$pubname'.war"}}],"json.pretty":1}'
    if (( usewar )); then
    wildflycmd '{"operation" : "composite", "address" : [], "steps" : [{"operation" : "add", "address" : {"deployment" : "'$pubname'.war"}, "content" : [{"url" : "file:'$webappdir'"}]},{"operation" : "deploy", "address" : {"deployment" : "'$pubname'.war"}}],"json.pretty":1}'
    else
    wildflycmd '{"operation" : "composite", "address" : [], "steps" : [{"operation" : "add", "address" : {"deployment" : "'$pubname'.war"}, "content" : [{"path" : "'$webappdir'", "archive":"false"}]},{"operation" : "deploy", "address" : {"deployment" : "'$pubname'.war"}}],"json.pretty":1}'
    fi
fi

inotifyEvents=""
if ! [[ "$(uname)" =~ ^CYGWIN ]]; then
        inotifyEvents="-e close_write"
fi

while inotifywait $inotifyEvents -r $webappdir --excludei "\.(js|html|css)$" || :; do
    if ! (( iswildfly )); then
        curl -v -H 'Accept: application/json' \
        -X POST \
        -H 'X-Requested-By: loadr' \
        -F force=true \
        -F id=$webappdir \
        -F isredeploy=true \
        -F virtualservers=server \
        -F contextRoot=$ctxroot \
        -F name=$pubname \
        http://localhost:$port/management/domain/applications/application
    else
        wildflycmd '{"operation" : "composite", "address" : [], "steps" : [{"operation" : "redeploy", "address" : {"deployment" : "'$pubname'.war"}}],"json.pretty":1}'
    fi
done

只需使用mvn clean wildfly:run启动Wildfly实例即可。

来源:autodeploy.sh

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31943842

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档