【发布时间】:2020-09-12 08:24:12
【问题描述】:
我已将 ui-sortable 库添加到 AngularJS 项目中,以在无序列表上实现拖放功能。项目使用bower管理UI库,bower.json同时包含jquery和jquery-ui
{
"name": "fountain-inject",
"version": "0.0.1",
"dependencies": {
"jquery": "3.5.1",
"jquery-ui": "1.12.1",
"angular": "1.7.9"
}
}
在 Windows 上本地构建时,所有单元测试都通过,但在 Linux 上的 Jenkins 中构建时,所有单元测试都通过,但随后报告此错误,并且构建失败
[INFO] PhantomJS 2.1.1 (Linux 0.0.0) ERROR
[INFO] An error was thrown in afterAll
[INFO] ReferenceError: Can't find variable: jQuery
[INFO] bower_components/jquery-ui/jquery-ui.js:14
[INFO] PhantomJS 2.1.1 (Linux 0.0.0): Executed 741 of 742 (skipped 1) ERROR (13.945 secs / 13.232 secs)
构建本身是多模块 maven 项目的前端模块。它使用frontend maven plugin 安装节点,拉取凉亭和节点依赖项,然后运行 gulp 构建文件,包括单元测试
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<nodeVersion>v12.13.1</nodeVersion>
</configuration>
</execution>
<execution>
<id>npm install</id>
<goals>
<goal>npm</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
<execution>
<id>bower install</id>
<goals>
<goal>bower</goal>
</goals>
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
<execution>
<id>gulp build</id>
<goals>
<goal>gulp</goal>
</goals>
<phase>test-compile</phase>
<configuration>
<arguments>build</arguments>
</configuration>
</execution>
<execution>
<id>gulp test</id>
<phase>test</phase>
<goals>
<goal>gulp</goal>
</goals>
<configuration>
<arguments>test --no-notification</arguments>
</configuration>
</execution>
</executions>
</plugin>
有谁知道如何解决这个问题?
【问题讨论】:
-
你不需要在构建服务器上
bower install吗? -
问题用 maven pom 更新,包括凉亭安装
标签: jquery angularjs jenkins jquery-ui bower