当前位置: 首页 > 面试题库 >

Maven在詹金斯上不起作用(但是通过Eclipse和命令行可以做到)

谭京
2023-03-14
问题内容

我对CI进行了一些测试,所有测试都在Maven中进行。当我在本地(Windows 10)的eclipse中运行它们,以及在ec2
linux服务器中通过命令行运行它们时,构建成功。

仅当我从詹金斯(Jenkins)构建同一个项目时,才会出现以下错误:

Waiting for Jenkins to finish collecting data[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.0:compile (default-compile) on project invalidlogin: Error while storing the mojo status: /var/lib/jenkins/workspace/project/invalidlogin/target/maven-status/maven- compiler-plugin/compile/default-compile/inputFiles.lst (Permission denied) -> [Help 1]

我正在使用PhantomJS作为浏览器。

如何让詹金斯工作?

  • 我使用chmod更新了权限,但仍然得到了相同的结果。
  • 为什么要通过控制台而不是jenkins运行它?

这是我的 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>
  <groupId>InvalidLoginV1</groupId>
  <artifactId>invalidlogin</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>invalidcredentials</name>
  <description>invalidcredentials</description>

  <properties>
<suiteXmlFile>src/main/resources/testng.xml</suiteXmlFile>

</properties>

<dependencies>
<dependency>
  <groupId>org.testng</groupId>
  <artifactId>testng</artifactId>
  <version>6.8</version>
  <scope>test</scope>
</dependency>

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-server</artifactId>
    <version>2.34.0</version>
    <scope>test</scope>
</dependency>

<dependency>
    <groupId>com.github.detro.ghostdriver</groupId>
    <artifactId>phantomjsdriver</artifactId>
    <version>1.0.4</version>
    <scope>test</scope>
</dependency>

<dependency>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-surefire-plugin</artifactId>
  <version>2.19.1</version>
  <type>maven-plugin</type>
</dependency>


</dependencies>

<build>


<plugins>

    <plugin>
          <groupId>com.github.klieber</groupId>
          <artifactId>phantomjs-maven-plugin</artifactId>
          <version>0.7</version>
    </plugin>



<plugin>



<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<compilerVersion>1.8</compilerVersion>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>


</plugins>

</build>

</project>

问题答案:

问题的确与权限有关。我在设置时遇到了一些问题,但是我在这里找到了该指南:http : //blog.manula.org/2013/03/running-
jenkins-under-different-user-in.html

基本上,您需要在服务器上添加一个预先存在的用户作为jenkins用户。 sudo vim /etc/sysconfig/jenkins

完成后,只需更改jenkins主页,webroot和日志的所有权

chown -R user:user/var/lib/jenkins 
chown -R user:user/var/cache/jenkins
chown -R user:user/var/log/jenkins

谢谢@Reimeus!



 类似资料:
  • 问题内容: 我有一个docker撰写文件 而且我已经配置了詹金斯工作以通过调用另一个外壳文件“ environment.sh”来执行此文件,但是它尝试执行以下错误: 我如何在jenkins服务器中下载和配置docker-compose,也没有可用的插件!,适用于docker-compose 问题答案: $ PATH环境变量中可能不存在您。 首先,您应该删除所有冲突的内容- 在大多数Linux系统上

  • 问题内容: 我无法通过Jenkins使用robotframework执行硒测试用例。安装了Firefox,geekodriver。 无需使用Jenkins即可工作。 获取异常 它是一个简单的测试用例 Jenkins Shell命令配置 问题答案: 在robotframework服务器中安装xvfb。还可以在Jenkins中使用xvfb插件。 似乎已弃用xvfb,并听说有一个vncserver插件。

  • 我在当地安装了Jenkinsci。通过Jenkins权威指南第2章的说明安装。我在运行El Capitan的MAC上通过Java Web start/jnlp文件启动Jenkins。一切都很顺利,样本项目正在工作。 我知道我想通过Jenkins运行我的Codeception验收测试。我正在关注Codeception网站上关于这个问题的最新博客文章:http://Codeception.com/02

  • 问题内容: 我是詹金斯的新手,目前正在尝试。我使用Eclipse并使用Gi​​t插件在Eclipse中运行Git,其描述如下:“ Eclipse Git是基于JGit的Eclipse Team提供程序,JGit是Git版本控制系统的纯Java实现”。 我已经为Jenkins安装了Git插件,但是当我对其进行配置时,Jenkins抱怨它找不到Git可执行文件。这很有意义,最明显的解决方案是安装它(在

  • 问题内容: 有人可以帮我摆脱Jenkins groovy脚本中的sed shell命令吗? 好辛苦 问题答案: 三重双引号()字符串文字语法允许变量/表达式替换(插值),因此反斜杠()被解释为特殊字符“转义”。由于第一个打开的括号不是这样的特殊字符,因此Groovy编译失败。如果要在结果字符串中使用文字反斜杠,则需要转义反斜杠。也就是说,使用双反斜杠()代替一个文字反斜杠。 从而:

  • 问题内容: 我正在Windows 7上运行詹金斯服务。 我想做一个非常简单的工作,这将启动我的Firefox。(例如) 我配置了一个自由样式项目,并设置了“执行Windows批处理命令”选项。 在这里,我尝试插入几条命令,但它们均失败了。 像“ echo hello”之类的命令或其他本机命令按预期工作。 但是类似“ explorer”的命令-应该打开提到的目录,否则“ c:\ firefox.ln