zoukankan      html  css  js  c++  java
  • spring boot war包改成jar包

    war包配置:

    <?xml version="1.0"?>
    <project 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"
    	xmlns="http://maven.apache.org/POM/4.0.0">
    	<modelVersion>4.0.0</modelVersion>
    	<parent>
    		<groupId>com.easytoolsoft</groupId>
    		<artifactId>easyreport</artifactId>
    		<version>2.0-SNAPSHOT</version>
    	</parent>
    	<artifactId>easyreport-web</artifactId>
    	<packaging>war</packaging>
    	<name>easyreport-web</name>
    	<description>Web view module</description>
    	<dependencies>
    		<!-- easyreport modules -->
    		<dependency>
    			<groupId>com.easytoolsoft</groupId>
    			<artifactId>easyreport-common</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>com.easytoolsoft</groupId>
    			<artifactId>easyreport-data</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>com.easytoolsoft</groupId>
    			<artifactId>easyreport-domain</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>com.easytoolsoft</groupId>
    			<artifactId>easyreport-membership</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>com.easytoolsoft</groupId>
    			<artifactId>easyreport-engine</artifactId>
    		</dependency>
    		<!-- third jars -->
    		<dependency>
    			<groupId>org.slf4j</groupId>
    			<artifactId>slf4j-api</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>ch.qos.logback</groupId>
    			<artifactId>logback-classic</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>ch.qos.logback</groupId>
    			<artifactId>logback-core</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>org.slf4j</groupId>
    			<artifactId>jcl-over-slf4j</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>org.logback-extensions</groupId>
    			<artifactId>logback-ext-spring</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>org.apache.commons</groupId>
    			<artifactId>commons-lang3</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>org.apache.commons</groupId>
    			<artifactId>commons-collections4</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>commons-io</groupId>
    			<artifactId>commons-io</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-aop</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-aspects</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-beans</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-context</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-context-support</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-core</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-expression</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-jdbc</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-web</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-webmvc</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-tx</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>com.alibaba</groupId>
    			<artifactId>fastjson</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>com.fasterxml.jackson.core</groupId>
    			<artifactId>jackson-databind</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>javax.servlet</groupId>
    			<artifactId>javax.servlet-api</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>javax.servlet</groupId>
    			<artifactId>jstl</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>org.projectlombok</groupId>
    			<artifactId>lombok</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>org.mybatis</groupId>
    			<artifactId>mybatis</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>org.mybatis</groupId>
    			<artifactId>mybatis-spring</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>org.apache.shiro</groupId>
    			<artifactId>shiro-core</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>org.apache.shiro</groupId>
    			<artifactId>shiro-web</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>org.apache.shiro</groupId>
    			<artifactId>shiro-spring</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>org.apache.shiro</groupId>
    			<artifactId>shiro-quartz</artifactId>
    		</dependency>
    		<!-- test -->
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-test</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>junit</groupId>
    			<artifactId>junit</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>org.springframework</groupId>
    			<artifactId>spring-test</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>org.mockito</groupId>
    			<artifactId>mockito-all</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>org.powermock</groupId>
    			<artifactId>powermock-module-junit4</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>org.powermock</groupId>
    			<artifactId>powermock-module-junit4-rule</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>org.powermock</groupId>
    			<artifactId>powermock-api-mockito</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>org.hamcrest</groupId>
    			<artifactId>hamcrest-core</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>org.hamcrest</groupId>
    			<artifactId>hamcrest-library</artifactId>
    		</dependency>
    		<dependency>
    			<groupId>org.elasticsearch.plugin</groupId>
    			<artifactId>x-pack-sql-jdbc</artifactId>
    		</dependency>
    	</dependencies>
    	<profiles>
    		<profile>
    			<id>dev</id>
    			<properties>
    				<props>src/main/filters/dev.properties</props>
    			</properties>
    			<activation>
    				<activeByDefault>true</activeByDefault>
    			</activation>
    		</profile>
    		<profile>
    			<id>test</id>
    			<properties>
    				<props>src/main/filters/test.properties</props>
    			</properties>
    		</profile>
    		<profile>
    			<id>prod</id>
    			<properties>
    				<props>src/main/filters/prod.properties</props>
    			</properties>
    		</profile>
    	</profiles>
    	<build>
    		<finalName>${project.artifactId}</finalName>
    		<filters>
    			<filter>${props}</filter>
    		</filters>
    		<resources>
    			<resource>
    				<directory>src/main/resources</directory>
    				<filtering>true</filtering>
    			</resource>
    			<resource>
    				<directory>src/main/webapp</directory>
    				<filtering>true</filtering>
    				<includes>
    					<include>WEB-INF/web.xml</include>
    				</includes>
    			</resource>
    		</resources>
    		<plugins>
    			<plugin>
    				<groupId>org.apache.maven.plugins</groupId>
    				<artifactId>maven-war-plugin</artifactId>
    				<configuration>
    					<webResources>
    						<resource>
    							<directory>${basedir}/src/main/webapp</directory>
    							<filtering>true</filtering>
    							<includes>
    								<include>**/web.xml</include>
    							</includes>
    						</resource>
    					</webResources>
    				</configuration>
    			</plugin>
    			<!-- add by mercy 不执行测试类 -->
    			<plugin>
    				<groupId>org.apache.maven.plugins</groupId>
    				<artifactId>maven-surefire-plugin</artifactId>
    				<configuration>
    					<skipTests>true</skipTests>
    				</configuration>
    			</plugin>
    		</plugins>
    	</build>
    </project>
    

    比较麻烦,以后再说吧,如果是标准的springboot项目就好做:

    一、

    <!--<packaging>war</packaging>-->
    <packaging>jar</packaging>


    二、

    <!--<build>
      <plugins>
        <plugin>
    				<artifactId>maven-war-plugin</artifactId>
    				<version>3.0.0</version>
    		</plugin>
    	</plugins>
    </build>-->
    
    <build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
            <mainClass>org.supwisdom.Application</mainClass> 
            </configuration>
        </plugin>
    </plugins>
    </build>

    三、注释掉spring-boot-starter-tomcat相关依赖,注释Application.java中SpringApplicationBuilder configure

    //    @Override
    //    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
    //        return application.sources(Application.class);
    //    }
        
        public static void main(String[] args) throws Exception {
        	System.setProperty("spring.devtools.restart.enabled", "false");
            SpringApplication.run(Application.class, args);
        }
  • 相关阅读:
    SiteMap 提交,并使用正确的方式提交给搜索引擎
    爱自己的人脸上散发的光芒是骗不了别人的,你会活在平静淡定喜悦中,绝少埋怨,鲜有不满,没有太多话需要澄清,说清楚,内心是一片宁静而有力量的海。
    PHP 调用webService方式
    Oracle数据库操作知道
    气泡 弹出 bootstrap-popover的配置与灵活应用
    mysql向表中某字段后追加一段字符串:
    LINUX 下安装一些东西,PHP Apach SSL 等
    在同一个页面上要使用多个百度分享,控件人分享的内容信息
    Linux study
    Mysql 备份
  • 原文地址:https://www.cnblogs.com/JAYIT/p/12932574.html
Copyright © 2011-2022 走看看