やりたいこと
thymeleaf(HTML)でbootstrapを使用したい
###現状
build.gradle
へ依存関係を記入してもライブラリがインストールされない。他の昨日はbuild.gradle
へ記入するだけでインストールされるのにwebjars
に限りインストールされない状況です。
buildgradle
1 2plugins { 3 id 'org.springframework.boot' version '2.1.3.RELEASE' 4 id 'java' 5} 6 7apply plugin: 'io.spring.dependency-management' 8 9group = 'com.example' 10version = '0.0.1-SNAPSHOT' 11sourceCompatibility = '11' 12 13configurations { 14 compileOnly { 15 extendsFrom annotationProcessor 16 } 17} 18 19repositories { 20 mavenCentral() 21} 22 23dependencies { 24 implementation "org.springframework.boot:spring-boot-starter-thymeleaf" 25 implementation "org.springframework.boot:spring-boot-starter-web" 26 implementation "org.springframework.boot:spring-boot-starter-jdbc" 27 compileOnly "org.projectlombok:lombok" 28 runtimeOnly "mysql:mysql-connector-java" 29 annotationProcessor "org.projectlombok:lombok" 30 testImplementation "org.springframework.boot:spring-boot-starter-test" 31 32 //バリデーション 33 compile "org.springframework.boot:spring-boot-starter-validation" 34 runtimeOnly "org.springframework.boot:spring-boot-devtools" 35 annotationProcessor "org.seasar.doma.boot:doma-spring-boot-starter:1.1.1" 36 37 //doma 38 compile("org.seasar.doma.boot:doma-spring-boot-starter:1.1.1") { 39 exclude group: "org.springframework.boot" 40 } 41 compile "org.apache.commons:commons-lang3" 42 //spring security 43 compile "org.springframework.boot:spring-boot-starter-security" 44 // thymeleaf(ロール/権限によるthymeleafのテンプレートの制御) 45 compile "org.thymeleaf.extras:thymeleaf-extras-springsecurity5" 46 // model mapper 47 compile "org.modelmapper:modelmapper:0.7.5" 48 //webjars 49 compile "org.webjars:bootstrap:4.0.0" 50 compile "org.webjars:jquery:3.1.1" 51 compile "org.webjars:font-awesome:5.6.1" 52 //thymeleaf 53 compile "nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:2.3.0" 54 55} 56apply plugin: 'idea' 57idaa.module.inheritOutputDirs = true 58processResources.destinationDir = compileJava.destinationDir 59compileJava.dependsOn processResources 60 61
■環境情報
jdk:11
IDE:IntelliJ IDEA2018 3.3 COMMUNITY EDITION
使用したいファイル内で以下のように参照していますが、そもそもライブラリがインストールできていない状態なのでもちろん表示は普通のHTMLです。
login.html
1 2<!DOCTYPE html> 3<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"> 4<head> 5 <title>Springboot</title> 6 <meta charset="utf-8" /> 7 <link th:href="@{/webjars/bootstrap/4.0.0/css/bootstrap.min.css}" rel="stylesheet" /> 8 <script type="text/javascript" th:src="@{/webjars/jquery/3.1.1/jquery.min.js}"></script> 9 <script type="text/javascript" th:src="@{/webjars/bootstrap/4.0.0/js/bootstrap.min.js}"></script> 10</head> 11<body> 12<h1 th:text="ログイン"></h1> 13略..... 14</body> 15</html> 16
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。