How to deploy .war file to JBoss AS 7 server using Maven?

后端 未结 2 378
遇见更好的自我
遇见更好的自我 2021-02-04 20:11

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.

2条回答
  •  逝去的感伤
    2021-02-04 20:36

    First, use bin/add-user.sh to add management user.

    Then, store that into your settings.xml.

    
    
        
            myproject-prod
            true
            
                mySecretPassword
            
        
    
    
    

    Then, configure the pom.xml.

    
        localhost  
        admin
        ${myproject.deploy.pass.prod}
        ${project.build.finalName}
    
    

    ...

        
            
                org.apache.maven.plugins
                maven-war-plugin
                2.3
                
                    true
                    ${plugin.war.warName}
                
                        
    
            
            
                org.jboss.as.plugins
                jboss-as-maven-plugin
                7.4.Final
                
                    true
                    ${jboss-as.deploy.hostname}
                    ${jboss-as.deploy.user}
                    ${jboss-as.deploy.pass.prod}
                    
                        target/${plugin.war.warName}.war
                    
                
            
        
    

    and then simply...

    mvn clean deploy;
    

    This is reduced from one JBoss project, may contain typos, but should work.

提交回复
热议问题