运行 应用程序到使用 maven 的嵌入式 jboss 服务器

Run app to embedded jboss server using maven

我通过这个 post http://buraktas.com/resteasy-example-without-using-a-web-xml/ 使用 resteasy 和 maven 作为构建工具创建了简单的休息服务器应用程序。或者可以使用 maven 运行 创建 war 到嵌入式 jboss 服务器?我想实现这个场景: 1. 我将我的项目推送到 git hub 与源文件和 pom.xml 2. 用户克隆 repo 并使用 maven 构建和 运行 应用程序。 3. 转到浏览器 http://localhost:8080/rest-helloworld/helloworld 并获取 hello msg.

pom.xml <- 现在需要 mvn clean install 准备 .war 并且需要复制粘贴到应用程序服务器。我想跳过这一步。

<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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>buraktas.com</groupId>
  <artifactId>rest-helloworld</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>war</packaging>

  <name>rest-helloworld</name>
  <url>http://maven.apache.org</url>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-jaxrs</artifactId>
        <version>3.0.6.Final</version>
        <scope>provided</scope>
    </dependency>
  </dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.3</version>
            <configuration>
                <failOnMissingWebXml>false</failOnMissingWebXml>
                <warName>rest-helloworld</warName>
            </configuration>
        </plugin>
    </plugins>
</build>


</project>

您可以使用 Maven JBoss Plugin 通过 Maven 执行 start/stop 和 deploy/undeploy 任务。