我已经创建了一个Spring Boot应用程序,其中我只有很少的Javascript&路径src / main / resources / public / app。中的Html文件。
我的项目文件夹结构是:
/project
-/src/main
-- /java
-- / resources
--- /application.properties
--- /public
---- /app
----- /index.html
----- /bower-components
----- /scripts
----- /views/**.html
----- /images
----- /styles
----/dist
-----/index.html
-----/vendor.ZXASF.js
-----/scripts.QASD.js
当我运行Javascript缩小任务时,我生成一个dist [distribution]文件夹,如上所示。现在我的要求是,我想告诉maven运行mvn clean install
时要在JAR文件中包含哪个文件夹。如果我以“DEBUG”模式运行,则文件夹src/main/resources/app
文件夹需要包含在JAR文件中。当我在“DEPLOY”模式下运行时,需要包含src/main/resources/dist
文件夹。请注意,JAR文件中这些文件夹的路径应该与项目文件夹结构一致。我试过几个选项,但直到现在都没有运气。我的pm.xml
如下:
<?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>spring-boot-demo</groupId>
<artifactId>spring-boot-demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>spring-boot-demo</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<start-class>demo.SpringBootDemoApplication</start-class>
<java.version>1.7</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
由于