springboot依赖第三方或本地jar(将其打入war包中)

核心(这个还是从之前maven项目拷贝过来的)

<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-war-plugin</artifactId>
				<configuration>
					<webResources>
						<resource>
							<directory>${localRepository}</directory>
							<targetPath>WEB-INF/lib</targetPath>
							<filtering>false</filtering>
							<includes>
								<include>**/*.jar</include>
							</includes>
						</resource>
					</webResources>
				</configuration>
			</plugin>

 

完整的如下:


	<properties>
            <localRepository>C:/Users/.m2/repository/com/betawoo/commons/1.0.1</localRepository>
	</properties>

	
	<dependencies>
		<!--百搭屋-公共包-->
		<dependency>
			<groupId>com.betawoo</groupId>
			<artifactId>commons</artifactId>
			<version>1.0.1</version>
			<scope>system</scope>
			<systemPath>${localRepository}/commons-1.0.1.jar</systemPath>
		</dependency>
		
	</dependencies>

<build>
		<finalName>${project.artifactId}</finalName>

		<plugins>

			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-war-plugin</artifactId>
				<configuration>
					<webResources>
						<resource>
							<directory>${localRepository}</directory>
							<targetPath>WEB-INF/lib</targetPath>
							<filtering>false</filtering>
							<includes>
								<include>**/*.jar</include>
							</includes>
						</resource>
					</webResources>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<configuration>
					<skip>true</skip>
				</configuration>
			</plugin>

			<!-- java编译插件 -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<source>1.8</source>
					<target>1.8</target>
					<encoding>UTF-8</encoding>
				</configuration>
			</plugin>

		</plugins>


	</build>

感谢文章

 

阅读更多
换一批

没有更多推荐了,返回首页