推荐使用Webjars的三大理由:好用
使用教程------引入相关依赖:
首先在 WebJars官网 /WebJars - Web Libraries in Jars找到项目所需的依赖在pom
引入 jQuery、BootStrap前端组件等。
发布私服-静态资源
静态资源pom-version版本号要与webjars一致。
配置 :POM
<dependency><!--Webjars版本定位工具-->
<groupId>org.webjars</groupId>
<artifactId>webjars-locator-core</artifactId>
</dependency>
<dependency><!--Jquery组件-->
<groupId>org.webjars</groupId>
<artifactId>jquery</artifactId>
<version>3.3.11</version>
</dependency>
修改:私服
<?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>org.webjars</groupId>
<artifactId>metronic</artifactId>
<version>5.2.5.RELEASE</version>
<packaging>jar</packaging>
<name>metronic</name>
<description>metronic</description>
<!--维护信息-->
<developers>
<developer>
<name>socks</name>
<email>https://github.com/yizhiwazi</email>
</developer>
</developers>
<!--发布地址-->
<distributionManagement>
<repository>
<id>xx-repo</id>
<!--替换成公司私服地址-->
<url>http://127.0.0.1:8098/nexus/content/repositories/thirdparty/</url>
</repository>
<snapshotRepository>
<id>xx-plugin-repo</id>
<!--替换成公司私服地址-->
<url>http://127.0.0.1:8098/nexus/content/repositories/thirdparty/</url>
</snapshotRepository>
</distributionManagement>
</project>
配置:私服账号
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>D:repository</localRepository>
<mirrors>
<!-- 阿里云仓库 -->
<mirror>
<id>aliyun</id>
<mirrorOf>central</mirrorOf>
<name>aliyun-all</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
</mirror>
<!-- *仓库1 -->
<mirror>
<id>repo1</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo1.maven.org/maven2/</url>
</mirror>
<!-- *仓库2 -->
<mirror>
<id>repo2</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo2.maven.org/maven2/</url>
</mirror>
</mirrors>
<!-- 暂时在发布仓库-->
<servers>
<!-- 仓库地址账号 -->
<server>
<id>xx-repo</id>
<username>admin</username>
<password>123456</password>
</server>
<!-- 插件地址账号 -->
<server>
<id>xx-plugin-repo</id>
<username>admin</username>
<password>123456</password>
</server>
</servers>
</settings>
maven->deploy。