2013-06-28 3 views
5

나는 "pom.xml"파일을 가지고있다.이 파일은 maven에 연결하고 코드를 체크 아웃하고 war 파일을 만든다. 이제 생성 된 war 파일을 JBoss Application Server 7에 배포해야합니다. 아래 내용은 pom.xml입니다.Maven을 사용하여 JBoss AS 7 서버에 .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/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:\Workspace\deploy-app\target</jboss_Home> 
       <serverName>default</serverName> 
       <fileName>target/deploy-app.war</fileName> 
      </configuration> 
     </plugin> 
     </plugins> 
    </build> 
</project> 

내 전쟁 파일을 Jboss 서버에 배포하는 단계를 알려주십시오.

+1

다음 링크를 확인해 주셔서 감사합니다. http://stackoverflow.com/questions/13376011/war-file-deployment-in-jboss-4-2-server-with-maven-repositories –

+0

다음 오류가 발생합니다. – Keerthana

+0

목표 org.jboss.as.plugins를 실행하지 못했습니다. jboss-as-maven-plugin : 7.3.Final : 프로젝트에 deploy (기본값) deploy-app : D : \에 goal deploy를 실행할 수 없습니다. Workspace \ deploy-app \ target \ deploy-app.war. 이유 : 오류가 작업을 실행할 수 없습니다 '{ [ERROR] "address"=> [], [ERROR] "작업"=> "읽기 속성", [ERROR] "name"=> "launch- [오류]} '. java.net.ConnectException : JBAS012144 : remote : // D-0190918 : 8080에 연결할 수 없습니다. 연결 시간이 초과되었습니다 Pls help me – Keerthana

답변

7

먼저 bin/add-user.sh을 사용하여 관리 사용자를 추가하십시오.

그런 다음 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의 프로젝트에서 감소는 오타를 포함 할 수 있습니다,하지만 작동합니다.

+0

답장을 보내 주셔서 감사합니다. 위의 단계를 시도해 보겠습니다. – Keerthana

+0

내가 bin/add-user.sh에 추가해야 할 내용을 알려주십시오. 나는 maven에 익숙하지 않고 위의 단계를 수행하는 중에 오류가 발생합니다. – Keerthana

+0

로컬 상자에서 실행중인 서버에 배포하는 경우 사용자를 추가 할 필요가 없습니다. 원격 서버에 배포하는 경우에만 사용자를 추가해야합니다. –

0
  • 먼저 bin/add-user.sh를 사용하여 관리 사용자 (admin/1234)를 추가하십시오.

  • 두 번째의 pom.xml에 추가 :

    <build>  
    <plugins>  
        <plugin> 
         <groupId>org.jboss.as.plugins</groupId> 
         <artifactId>jboss-as-maven-plugin</artifactId> 
         <version>7.5.Final</version> 
         <configuration> 
          <hostname>localhost</hostname> 
          <port>9999</port> 
          <name>app_name.war</name> 
          <username>admin</username> 
          <password>1234</password> 
         </configuration> 
        </plugin> 
    </plugins> 
    

  • 세 : JBOSS_HOME/독립형/구성을 편집/변경 standalone.xml IP 주소 0.0.0.0에 : enter image description here

  • 네, #clean install jboss-as를 사용하여 배포 : 재배포 enter image description here

+0

안녕하세요, 서버 또는 사용자를 추가하십시오. 우리가 배치 할 원격 상자? 내가 그 문제에 직면하고 있다고 제발 말할 수 있니? – Vikram

0

이전 솔루션은 작동하지 않았습니다.

[ERROR] Failed to execute goal org.jboss.as.plugins:jboss-as-maven-plugin:7.5.Final:deploy (default-cli) on project bitcoincalculator-front: Could not execute goal deploy on /home/frederik/git/bitcoincalculator/app/target/app.war. Reason: I/O Error could not execute operation '{ 
[ERROR] "operation" => "read-attribute", 
[ERROR] "address" => [], 
[ERROR] "name" => "launch-type" 
[ERROR] }': java.net.ConnectException: JBAS012144: Could not connect to remote://localhost:9999. The connection timed out 

당신은 솔루션 전에 게시 검토해야합니다 :

나는 다음 오류를 얻을 수 있습니다. 그것은 전문적이 아닙니다

관련 문제