【发布时间】:2018-10-21 23:49:31
【问题描述】:
我遇到了一个非常奇怪的问题 - 我创建了创建“fat-jar”的多模块 java 项目。不幸的是,“前端”模块 jar 在 jenkins(linux) 上启动时没有资源 - 由于某种原因它确实可以在 Windows 上运行:
这是“前端”pom:
<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>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.1.RELEASE</version>
<relativePath/>
</parent>
<groupId>com.frontend</groupId>
<artifactId>frontend-app</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<build>
<resources>
<resource>
<directory>dist</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<phase>generate-resources</phase>
</execution>
<execution>
<id>npm install</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
<execution>
<id>node build app</id>
<phase>prepare-package</phase>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>run-script build</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
我试过了:
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
但这也无济于事。
默认的 npm 构建目标是
ng build --output-path dist/META-INF/resources
目标中的 Jar 文件不包含来自“dist”的文件 -> 当我在默认位置 src/main/resources 创建它时它也不起作用
maven 日志输出包括:
[WARNING] JAR will be empty - no content was marked for inclusion!
dist 目录是在构建过程中创建和填充的。 Maven 在 Windows 上定位文件,但不在 Jenkins 上。
编辑:
maven 的目标是一样的。
【问题讨论】:
标签: java angular maven spring-boot