Maven Webjar Build and use

Source: Internet
Author: User

The purpose of this is to put the front-end static files, CSS Ah js ah a bunch of put in a MAVEN project management, need to call the jar package direct reference.

1. Put the files you want to pack into another MAVEN project/src/main/resources

2, Write Pom.xml

1     <build>2         <resources>3             <resource>4                 <directory>${ Project.basedir}/src/main/resources</directory>5                 <targetpath>meta-inf/resources/</ Targetpath>6             </resource>7         </resources>8     </ Build>                

3. Increase in SPRINGMVC configuration

<mvc:resources mapping= "/webjars/**" location= "classpath:/meta-inf/resources/webjars/" ></mvc:resources >

4. Call jar package in Project Pom file

5. View the display

A Web project that relies on the jar can be accessed through http://ip:port/[projectname]/webjars/jsname.js

6. Packing

Execute packaging command: MVN clean Package

After unpacking the package/resources/webjars/jsname.js

Maven Webjar Build and use

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.