zoukankan      html  css  js  c++  java
  • Atitit maven配置pom文件 配置法v2 t33 目录 1. Maven打包war原理 1 1.1. 在target目录生成war包ori目录。。。里面就是所有的资源 1 1.2. 去掉

    Atitit maven配置pom文件 配置法v2 t33

     

     

    目录

    1. Maven打包war原理 1

    1.1. 在target目录生成war包ori目录。。。里面就是所有的资源 1

    1.2. 去掉全部jar,使用eclipse本地库,因为maven库update prj有问题 2

    1.3. 复制libs 3

    1.4. 在没有web.xml文件的情况下构建WAR 4

     

     

    1. Maven打包war原理
      1. 在target目录生成war包ori目录。。。里面就是所有的资源

     

    <?xml version="1.0" encoding="UTF-8"?>

    <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>ttadmingroupId</groupId>

    <artifactId>tt-admin</artifactId>

     

    <name>tt-admin</name>

    <version>1.1</version>

    <packaging>war</packaging>

     

     

     

    <!-- <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId>

    <version>2.0.1.RELEASE</version> </parent> -->

     

    <!--</profile></profiles> -->

     

    <properties>

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

    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

    <java.version>1.8</java.version>

    <shiro.version>1.4.0</shiro.version>

    <kaptcha.version>2.3.2</kaptcha.version>

    <ehcache.version>3.3.1</ehcache.version>

    <beetl.version>2.9.3</beetl.version>

    <swagger.version>2.9.1</swagger.version>

    <ehcache.core.version>2.6.11</ehcache.core.version>

    <mysql-connector-java.version>8.0.11</mysql-connector-java.version>

    <jwt.version>0.9.0</jwt.version>

    </properties>

     

     

     

      1. 去掉全部jar,使用eclipse本地库,因为maven库update prj有问题

    <dependencies>

     

     

     

     

    </dependencies>

     

    <build>

     

     

     

    <!-- war filename -->

    <finalName>admin</finalName>

    <!-- war position def positon is : <directory>0warout\adminWarOut</directory> -->

     

    <!-- eclipse out class dir is tt-admin/target/classes -->

    <sourceDirectory>srcnone</sourceDirectory>

     

     

     

    <plugins>

     

     

      1. 复制libs

    <plugin>

    <groupId>org.apache.maven.plugins</groupId>

    <artifactId>maven-resources-plugin</artifactId>

    <configuration>

    <delimiters>

    <delimiter>@</delimiter>

    </delimiters>

    <useDefaultDelimiters>false</useDefaultDelimiters>

    </configuration>

     

    <!-- copy res -->

    <executions>

     

     

     

    <execution>

    <id>copy-resources3_copy_generated-sources_annotations</id>

    <!-- here the phase you need -->

    <phase>validate</phase>

    <goals>

    <goal>copy-resources</goal>

    </goals>

    <configuration>

    <outputDirectory>${basedir}/target/generated-sources/annotations</outputDirectory>

    <resources>

     

    <resource>

    <directory>${basedir}/srcnone</directory>

     

    </resource>

    </resources>

    </configuration>

    </execution>

     

     

     

     

     

     

    <execution>

    <id>copy-resources_copyLibs</id>

    <!-- here the phase you need -->

    <phase>validate</phase>

    <goals>

    <goal>copy-resources</goal>

    </goals>

    <configuration>

    <outputDirectory>${basedir}/target/admin/WEB-INF/lib</outputDirectory>

    <resources>

     

    <resource>

    <directory>lib</directory>

     

    </resource>

    </resources>

    </configuration>

    </execution>

     

     

     

     

     

     

    </executions>

     

     

     

    </plugin>

     

     

      1. 在没有web.xml文件的情况下构建WAR

    <plugin>

    <artifactId>maven-war-plugin</artifactId>

    <version>2.6</version>

    <configuration>

    <!--如果想在没有web.xml文件的情况下构建WAR,请设置为false。 -->

    <failOnMissingWebXml>false</failOnMissingWebXml>

    </configuration>

    </plugin>

     

     

    <plugin>

    <groupId>org.apache.maven.plugins</groupId>

    <artifactId>maven-compiler-plugin</artifactId>

    <version>3.1</version>

    <configuration>

    <source>${java.version}</source>

    <target>${java.version}</target>

    </configuration>

    </plugin>

    <plugin>

    <groupId>org.springframework.boot</groupId>

    <artifactId>spring-boot-maven-plugin</artifactId>

    <configuration>

    <fork>true</fork><!-- 如果没有该项配置,肯呢个devtools不会起作用,即应用不会restart -->

    </configuration>

    </plugin>

     

     

     

    </plugins>

    <resources>

     

    <!--

    <resource>

    <directory>src/main/webapp</directory>

    </resource>

     

      -->

    <resource>

    <directory>src/main/resources</directory>

    <filtering>true</filtering>

    </resource>

    <resource>

    <directory>src/main/java</directory>

    <includes>

    <include>**/*.xml</include>

    </includes>

    </resource>

    </resources>

    </build>

     

    <profiles>

    <profile>

    <id>local</id>

    <properties>

    <spring.active>local</spring.active>

    </properties>

    <activation>

    <activeByDefault>true</activeByDefault>

    </activation>

    </profile>

    <profile>

    <id>dev</id>

    <properties>

    <spring.active>dev</spring.active>

    </properties>

    </profile>

    <profile>

    <id>test</id>

    <properties>

    <spring.active>test</spring.active>

    </properties>

    </profile>

    <profile>

    <id>produce</id>

    <properties>

    <spring.active>produce</spring.active>

    </properties>

    </profile>

    </profiles>

     

     

    </project>

     

     

    Ref

    Atitit maven 编译与资源文件与web目录自定义配置 与eclipse的集成与war包打包

     

  • 相关阅读:
    部署K2 Blackpearl流程时出错(与基础事务管理器的通信失败或Communication with the underlying transaction manager has failed.)
    用SQL命令将查询结果集导出为文本文件
    SQL函数计算两个日期间的工作日天数
    CommonJS模块加载方法
    async 属性
    如何用VS.NET2005调式.asp和.aspx混合的web系统
    对web.config文件的节点进行加解密
    [转]看似简单的问题 静态方法和实例化方法的区别
    单引号(')和双引号(")
    从一个时间段中查找出星期为“Sunday”的日期
  • 原文地址:https://www.cnblogs.com/attilax/p/15197366.html
Copyright © 2011-2022 走看看