The difference between jar and war in maven

       The jar file includes java common classes, resource files and common files. In maven, all files under the src/main/java and src/main/resources resource folders are packaged. When packaging, the MATA-INF folder is automatically generated to store maven's pom information and MANIFEST.MF file. E.g:



        The war file contains all web applications, that is, all java classes, configuration information and static resources such as jsp and js. However, it should be noted that when a war refers to a war, all the resources of the application war will be copied to the same file of the current war, and the files with the same name will be replaced. E.g:

war package dependencies:

    <dependency>  
          <groupId>com.my.module</groupId>  
          <artifactId>module1</artifactId>  
          <version>0.0.1-SNAPSHOT</version>  
          <type>war</type>  
    </dependency>  

module4 depends on module1. After compilation, the module1 class file is copied to the classes file in module4, and the jsp is copied to the corresponding jsp directory.


The original address of the article: https://blog.csdn.net/mafan121/article/details/51880072


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325977929&siteId=291194637