Сбой сборки Maven в jenkins на сервере Linux ec2

#linux #maven #selenium #jenkins #amazon-ec2

#linux #maven #selenium #дженкинс #amazon-ec2

Вопрос:

У меня есть проект maven с моими тестами selenium. Проект отлично запускается с моего локального (я использую windows10).

Однако, когда я запускаю их с сервера Linux ec2, сборка завершается с ошибкой.

Для установки Firefox я использовал следующий скрипт:

     #!/bin/bash
# GTK  and Firefox for Amazon Linux
# Written by Joseph Lawson 2012-06-03
# http://joekiller.com
# http://joekiller.com/2012/06/03/install-firefox-on-amazon-linux-x86_64-compiling-gtk/

# chmod 755 ./gtk-firefox.sh
# sudo ./gtk-firefox.sh


TARGET=/usr/local

function init()
{
export installroot=$TARGET/src
export workpath=$TARGET

yum --assumeyes install make libjpeg-devel libpng-devel 
libtiff-devel gcc libffi-devel gettext-devel libmpc-devel 
libstdc  46-devel xauth gcc-c   libtool libX11-devel 
libXext-devel libXinerama-devel libXi-devel libxml2-devel 
libXrender-devel libXrandr-devel libXt dbus-glib 
libXdamage libXcomposite
mkdir -p $workpath
mkdir -p $installroot
cd $installroot
PKG_CONFIG_PATH="$workpath/lib/pkgconfig"
PATH=$workpath/bin:$PATH
export PKG_CONFIG_PATH PATH

bash -c "
cat << EOF > /etc/ld.so.conf.d/firefox.conf
$workpath/lib
$workpath/firefox
EOF
ldconfig
"
}

function finish()
{
     cd $workpath
     wget -r --no-parent --reject "index.html*" -nH --cut-dirs=7 http://download.cdn.mozilla.net/pub/mozilla.org/firefox/releases/latest/linux-x86_64/en-US/
     tar xvf firefox*
     cd bin
     ln -s ../firefox/firefox
     ldconfig
}

function install()
{
     wget $1
     FILE=`basename $1`
     if [ ${FILE: -3} == ".xz" ]
        then tar xvfJ $FILE
        else tar xvf $FILE
     fi
SHORT=${FILE:0:4}*
     cd $SHORT
     ./configure --prefix=$workpath
     make
     make install
     ldconfig
     cd ..
}

init
install ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.xz
install http://download.savannah.gnu.org/releases/freetype/freetype-2.4.9.tar.gz
install http://www.freedesktop.org/software/fontconfig/release/fontconfig-2.9.0.tar.gz
install http://ftp.gnome.org/pub/gnome/sources/glib/2.32/glib-2.32.3.tar.xz
install http://cairographics.org/releases/pixman-0.26.0.tar.gz
install http://cairographics.org/releases/cairo-1.12.2.tar.xz
install http://ftp.gnome.org/pub/gnome/sources/pango/1.30/pango-1.30.0.tar.xz
install http://ftp.gnome.org/pub/gnome/sources/atk/2.4/atk-2.4.0.tar.xz
install http://ftp.gnome.org/pub/GNOME/sources/gdk-pixbuf/2.26/gdk-pixbuf-2.26.1.tar.xz
install http://ftp.gnome.org/pub/gnome/sources/gtk /2.24/gtk -2.24.10.tar.xz
finish


# adds the /usr/local/bin to your path by updating your .bashrc file.
cat << EOF >> ~/.bashrc
PATH=/usr/local/bin:$PATH
export PATH
EOF
  

Единственное отличие заключается в том, что вместо последней версии Firefox я перешел на версию 46, поскольку я использую selenium 2.53

Затем я обнаружил, что версия 46 несовместима с GTK 2.24, поэтому я отредактировал документ, чтобы понизить его до firefox 45, обновил свой файл .bashrc до

 cat << EOF >> ~/.bashrc
PATH=/usr/local/bin:$PATH
export PATH
EOF
  

Я все еще застрял.
это ошибка, которую я получаю при запуске mvn clean install:

 Results :

Failed tests:
  ValidLogin.test:15 » WebDriver Failed to connect to binary FirefoxBinary(/usr/...

Tests run: 1, Failures: 1, Errors: 0, Skipped: 0

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 56.244 s
[INFO] Finished at: 2016-10-23T18:43:49 00:00
[INFO] Final Memory: 16M/58M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test (default-test) on project devkernel: There are test failures.
[ERROR]
[ERROR] Please refer to /var/lib/jenkins/workspace/Login/devkernel/target/surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
  

и когда я запускаю mvn -X:

 [ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
org.apache.maven.lifecycle.NoGoalSpecifiedException: No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy.
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:94)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoGoalSpecifiedException
  

Не могли бы вы знать, как это решить, пожалуйста?

Комментарии:

1. Не отсутствуют ли фазы в последнем вызове? Разве это не должно быть mvn -X clean install ?

2. Я все еще получаю те же результаты

3. запустите «mvn -X clean install», чтобы узнать подробности неудачных тестов, а не «mvn -X»

4. правильно ли установлен firefox?