Collect from 企业网站模板

springboot把自己的jar包打进项目里

第一次登录送5个金币,绑定QQ送5个金币。金币可以用来观看视频和下载资源哦!

引入自己的包依赖

<dependency>
            <groupId>com.sun.DateUtils</groupId>
            <artifactId>dateUtils</artifactId>
            <version>0.0.1</version>
            <scope>system</scope>
            <systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/dateUtils.jar</systemPath>
        </dependency>
		<dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2.1</version>
            <scope>system</scope>
            <systemPath>${project.basedir}/src/main/webapp/WEB-INF/lib/jstl-1.2.1.jar</systemPath>
        </dependency>

注意:重点是systemPath这个路径必须得是你jar的路径。其他的按照套路填就行,要求不是太严格。${project.basedir}只是一个系统自己的常量,不用管它

  <scope>system</scope>不能少

打包的代码

<build>
        <!-- 注意最下面的build这块一定要配置否则打jar的时候会说找不 到主类 -->
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <!-- 注意:记住啊 下面<version>1.4.2.RELEASE</version>
                          这行代码是必须要加的不加的话就全GG了,因为springboot打包有个bug
                          反正这行代码别忘了加
                     -->
                <version>1.4.2.RELEASE</version>
                <configuration>
                    <mainClass>s.jf3q.com.Application</mainClass>
                    <includeSystemScope>true</includeSystemScope>
                </configuration>
            </plugin>
        </plugins>
        <!--这里进行配置,后会自动的加载src/main/webapp下的所有文件 :配置Maven 对resource文件 过滤 -->
        <!-- 我之前遇见的jsp找不到的问题 就是因为没有配置好以下的文件所以才会加载不到jsp配置文件 -->
        <resources>
            <resource>
                <directory>src/main/webapp</directory>
                <targetPath>META-INF/resources</targetPath>
                <includes>
                    <include>**/**</include>
                </includes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
    </build>

注意启动类改成自己的

 <includeSystemScope>true</includeSystemScope>引入自己的包依赖配置
在此处输入评论

允许提问者通过qq联系我

    现在绑定QQ

点击加载更多...