如何使用 Maven 将 .war 文件部署到 JBoss AS 7 服务器? [英] How to deploy .war file to JBoss AS 7 server using Maven?
本文介绍了如何使用 Maven 将 .war 文件部署到 JBoss AS 7 服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有pom.xml"文件,它连接到 maven 并检查代码并创建一个 war 文件.现在我必须将创建的 war 文件部署到 JBoss Application Server 7.下面是我的 pom.xml
.
I have "pom.xml" file which is connecting to maven and checking out the code and creating a war file. Now I have to deploy the created war file to JBoss Application Server 7. Below is my pom.xml
.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org /2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.deploy</groupId>
<artifactId>deploy-app</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>deploy-app Maven Webapp</name>
<url>http://maven.apache.org</url>
<scm>
<connection>scm:svn:http://d-113017553/svn/PRONTO/trunk/dev</connection>
<developerConnection>scm:svn:http://d-113017553/svn/PRONTO/trunk /dev</developerConnection>
<url>http://d-113017553/svn/PRONTO/trunk/dev</url>
</scm>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>deploy-app</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-plugin</artifactId>
<version>1.8.1</version>
<configuration>
<connectionType>connection</connectionType>
<username>keerthana</username>
<password>keerthana</password>
<checkoutDirectory>${project.basedir}/co/src</checkoutDirectory>
<workingDirectory>${project.basedir}/co/src</workingDirectory>
</configuration>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.2.2</version>
<configuration>
<releaseProfiles>release</releaseProfiles>
<goals>scm:checkout</goals>
</configuration>
</plugin>
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<version>7.3.Final</version>
<configuration>
<jboss_Home>D:Workspacedeploy-app arget</jboss_Home>
<serverName>default</serverName>
<fileName>target/deploy-app.war</fileName>
</configuration>
</plugin>
</plugins>
</build>
</project>
请告诉我将我的 war 文件部署到 Jboss 服务器的步骤.
Please give me the steps to deploy my war file to the Jboss Server.
推荐答案
首先使用bin/add-user.sh
添加管理用户.
然后,将其存储到您的 settings.xml 中.
Then, store that into your settings.xml.
<profiles>
<profile>
<id>myproject-prod<id>
<activation><activeByDefault>true</activeByDefault></activation>
<properties>
<myproject.deploy.pass.prod>mySecretPassword</myproject.deploy.pass.prod>
</properties>
</profile>
</profiles>
然后,配置pom.xml
.
<properties>
<jboss-as.deploy.hostname>localhost</jboss-as.deploy.hostname> <!-- Where to deploy. -->
<jboss-as.deploy.user>admin</jboss-as.deploy.user>
<jboss-as.deploy.pass>${myproject.deploy.pass.prod}</jboss-as.deploy.pass>
<plugin.war.warName>${project.build.finalName}</plugin.war.warName>
</properties>
...
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<filteringDeploymentDescriptors>true</filteringDeploymentDescriptors>
<warName>${plugin.war.warName}</warName>
</configuration>
</plugin>
<!-- JBoss AS plugin to deploy the war. -->
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<version>7.4.Final</version>
<configuration>
<force>true</force>
<hostname>${jboss-as.deploy.hostname}</hostname>
<username>${jboss-as.deploy.user}</username>
<password>${jboss-as.deploy.pass.prod}</password>
<fileNames>
<fileName>target/${plugin.war.warName}.war</fileName>
</fileNames>
</configuration>
</plugin>
</plugins>
然后简单地...
mvn clean deploy;
这是从一个 JBoss 项目缩减而来的,可能包含拼写错误,但应该可行.
This is reduced from one JBoss project, may contain typos, but should work.
这篇关于如何使用 Maven 将 .war 文件部署到 JBoss AS 7 服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文