Spring Boot AngularJs应用程序:使用wro4j-maven-plugin生成angular-bootstrap.css失败 [英] Spring Boot AngularJs Application: angular-bootstrap.css generation using wro4j-maven-plugin Fails

查看:135
本文介绍了Spring Boot AngularJs应用程序:使用wro4j-maven-plugin生成angular-bootstrap.css失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在关注本教程的第1部分。我已经达到了这个部分从Angular加载动态资源。根据教程说明,当我使用maven mvn clean package 构建应用程序时,wro4j-maven-plugin无法生成angular-bootstrap.css但是angular-bootstrap .js已成功生成。我在mvn控制台中收到以下警告

I am following the part 1 of this tutorial. I have reached this section "Loading a Dynamic Resource from Angular". As per the tutorial instructions, when I build the aplication using maven mvn clean package, the wro4j-maven-plugin fails to generate the angular-bootstrap.css but the angular-bootstrap.js is generated successfully. I am getting the following warnings in the mvn console

$ mvn clean package
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building demo 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.6.1:clean (default-clean) @ myDemo ---
[INFO] Deleting E:\workspace\demo\target
[INFO]
[INFO] --- wro4j-maven-plugin:1.8.0:run (default) @ myDemo ---
[INFO] E:\workspace\demo/src/main/wro
[INFO] Executing the mojo:
[INFO] Wro4j Model path: E:\workspace\demo\src\main\wro\wro.xml
[INFO] targetGroups: null
[INFO] minimize: true
[INFO] ignoreMissingResources: null
[INFO] parallelProcessing: false
[INFO] buildDirectory: E:\workspace\demo\target
[INFO] destinationFolder: E:\workspace\demo\target
[INFO] jsDestinationFolder: E:\workspace\demo\target\classes\static\js
[INFO] cssDestinationFolder: E:\workspace\demo\target\classes\static\css
[INFO] The following groups will be processed: [angular-bootstrap]
[INFO] folder: E:\workspace\demo\target\classes\static\css
[INFO] processing group: angular-bootstrap.css
[WARNING] Less warnings are:
[WARNING] 0:2 Cannot link source map. Css result location is not know and could not be deduced from input less source..
[INFO] folder: E:\workspace\demo\target\classes\static\js
[INFO] processing group: angular-bootstrap.js
[INFO] file size: angular-bootstrap.js -> 240652 bytes
[INFO] E:\workspace\demo\target\classes\static\js\angular-bootstrap.js (240652 bytes)

因此,当我运行应用程序时,我得到的是angular-bootstrap.css的404。请让我知道我哪里出错了。请在下面找到相关配置。

As a result of this, when I run the application, I am getting 404 for angular-bootstrap.css. Please let me know where I am going wrong. Please find the relevant configurations below.

/demo/src/main/wro/wro.xml

<groups xmlns="http://www.isdc.ro/wro">
  <group name="angular-bootstrap">
    <css>webjar:bootstrap/3.3.7-1/less/bootstrap.less</css>   
    <css>file:@project.basedir@/src/main/wro/main.less</css>
    <js>webjar:jquery/2.2.4/jquery.min.js</js>
    <js>webjar:angularjs/1.4.9/angular.min.js</js>
    <js>webjar:angularjs/1.4.9/angular-route.min.js</js>
    <js>webjar:angularjs/1.4.9/angular-cookies.min.js</js>
   </group>
</groups>

/demo/src/main/wro/wro.properties

preProcessors=lessCssImport
postProcessors=less4j,jsMin

/demo/src/main/wro/main.less [实际上此文件为空。]

/demo/src/main/wro/main.less [Actually this file is empty.]

/demo/pom.xml

<build>

  <plugins>
    <plugin>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-maven-plugin</artifactId>
    </plugin>
    <plugin>
      <groupId>ro.isdc.wro4j</groupId>
      <artifactId>wro4j-maven-plugin</artifactId>
      <version>1.8.0</version>
      <executions>
        <execution>
          <phase>generate-resources</phase>
          <goals>
            <goal>run</goal>
          </goals>
        </execution>
      </executions>
      <configuration>
        <wroManagerFactory>ro.isdc.wro.maven.plugin.manager.factory.ConfigurableWroManagerFactory</wroManagerFactory>
        <cssDestinationFolder>${project.build.directory}/classes/static/css</cssDestinationFolder>
        <jsDestinationFolder>${project.build.directory}/classes/static/js</jsDestinationFolder>
        <wroFile>${basedir}/src/main/wro/wro.xml</wroFile>
        <extraConfigFile>${basedir}/src/main/wro/wro.properties</extraConfigFile>
        <contextFolder>${basedir}/src/main/wro</contextFolder>
      </configuration>
      <dependencies>
        <dependency>
          <groupId>org.webjars</groupId>
          <artifactId>jquery</artifactId>
          <version>2.2.4</version>
        </dependency>
        <dependency>
          <groupId>org.webjars</groupId>
          <artifactId>angularjs</artifactId>
          <version>1.4.9</version>
        </dependency>
        <dependency>
          <groupId>org.webjars</groupId>
          <artifactId>bootstrap</artifactId>
          <version>3.3.7</version>
        </dependency>
      </dependencies>
    </plugin>
  </plugins>

</build>

我正在使用

Apache Maven 3.3.9
Java version: 1.8.0_111
spring-boot 1.4.2.RELEASE
OS : windows 10



编辑1



我在mvn中尝试使用--debug标志。我收到了这个调试消息

Edit 1

I tried with --debug flag in mvn. I got this debug message

[DEBUG] Created file: angular-bootstrap.css
[DEBUG] No content found for group: angular-bootstrap.css


推荐答案

问题到了在pom.xml中更改bootstrap的版本后修复如下:

The issue got fixed after changing the version of bootstrap in pom.xml as follows

<dependency>
  <groupId>org.webjars</groupId>
  <artifactId>bootstrap</artifactId>
  <version>3.3.7-1</version>
</dependency>

现在,angular-bootstrap.css已成功生成。

Now the angular-bootstrap.css is getting generated successfully.

这篇关于Spring Boot AngularJs应用程序:使用wro4j-maven-plugin生成angular-bootstrap.css失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆