0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

WildFly Maven Pluginを使ってWildFlyにデプロイ(メモ)

Posted at

はじめに

WildFly Maven Pluginを使ってWildFlyにデプロイする。

環境

  • CentOS 7.5(JDK8インストール済み)
  • WildFly 20.0.1.Final
  • WildFly Maven Plugin 2.1.0.Beta1

Wildflyのインストール

Wildflyは以下からダウンロード。

以下のコマンドでインストールと起動。

# tar xvzf /tmp/wildfly-20.0.1.Final.tar.gz -C /opt

# cd /opt/wildfly-20.0.1.Final/bin/
# ./standalone.sh -b 0.0.0.0 –bmanagement=0.0.0.0
~省略~
00:21:59,063 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 20.0.1.Final (WildFly Core 12.0.3.Final) started in 6161ms - Started 314 of 580 services (370 services are lazy, passive or on-demand)
00:21:59,065 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management
00:21:59,065 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990

ユーザー作成

# ./add-user.sh -u 'testadmin' -p 'xxxxxxxxxx'

デプロイするサンプルアプリケーション作成

以下でサンプルアプリケーションを作成し、warファイルまで作成。

mvn archetype:generate -DgroupId=com.example -DartifactId=web-app -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false

mvn compile war:war

以下のwarファイルが生成される。

.\web-app\target\web-app.war

WildFlyにデプロイ

作成したプロジェクトのpom.xmlにWildFly Maven Pluginを追加。

pom.xml
  <build>
    <finalName>web-app</finalName>
    <plugins>
      <plugin>
        <groupId>org.wildfly.plugins</groupId>
        <artifactId>wildfly-maven-plugin</artifactId>
        <version>2.1.0.Beta1</version>
        <configuration>
          <hostname>192.168.10.56</hostname>
          <username>testadmin</username>
          <password>xxxxxxxxxxxx</password>
        </configuration>
      </plugin>
    </plugins>
  </build>

以下でデプロイ。

> mvn wildfly:deploy
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------< com.example:web-app >-------------------------
[INFO] Building web-app Maven Webapp 1.0-SNAPSHOT
[INFO] --------------------------------[ war ]---------------------------------
[INFO]
[INFO] >>> wildfly-maven-plugin:2.1.0.Beta1:deploy (default-cli) > package @ web-app >>>
~省略~
[INFO] JBoss Threads version 2.3.3.Final
[INFO] JBoss Remoting version 5.0.12.Final
[INFO] XNIO version 3.7.2.Final
[INFO] XNIO NIO Implementation Version 3.7.2.Final
[INFO] ELY00001: WildFly Elytron version 1.9.1.Final
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  5.630 s
[INFO] Finished at: 2020-07-11T08:00:42+09:00
[INFO] ------------------------------------------------------------------------

参考

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?