WebJars统一管理静态资源

推荐使用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。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值