How to get Maven to run war:exploded but not war:war

后端 未结 5 1703
长情又很酷
长情又很酷 2020-12-04 16:30

I have a Maven pom that uses war. But actually, I don\'t want build the war-file, I just want all the dependent jars collect

5条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-04 17:07

    I would like to upgrade onto @Michael Wyraz answer and just include install skip settings in case if someone executes mvn clean install build on top level of multimodule project and one of sub-module is web application.

    This stands inside war module:

    
        
            war_explode
            
                
                    
                        
                            org.apache.maven.plugins
                            maven-war-plugin
                            2.6
                            
                                
                                    default-war
                                    none
                                
                                
                                    war-exploded
                                    package
                                    
                                        exploded
                                    
                                
                            
                        
                        
                            org.apache.maven.plugins
                            maven-install-plugin
                            
                                
                                    default-install
                                    none
                                
                            
                        
                    
                
            
        
    
    

    Without install skip build fails as it tries to install war into .m2 folder. Error message looks like this:

    [INFO] --- maven-install-plugin:2.4:install (default-install) @ *** ---
    [INFO]   ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.4:install (default-install) on project ***: The packaging for this project did not assign a file to the build artifact -> [Help 1]
    

    Executing mvn clean install -P war_explode with this settings (enclosed in maven profile named war_explode) it finishes build without error.

提交回复
热议问题