Mac + Selenium + Maven +JUnit + Jenkins CI

Добрый день! Пытаюсь настроить CI, но отображается ошибка в Jenkins при сборке Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (default-compile). Содержимое pom.xml

<groupId>OrderAppAppiumMaven</groupId>
<artifactId>OrderAppAppiumMaven</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.5.1</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.19.1</version>
            <configuration>
                <includes>
                    <include>Test*.java</include>
                </includes>
            </configuration>
        </plugin>
    </plugins>
</build>


<dependencies>
    <dependency>
        <groupId>io.appium</groupId>
        <artifactId>java-client</artifactId>
        <version>2.2.0</version>
    </dependency>


    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>2.53.0</version>
    </dependency>


    <dependency>
        <groupId>org.json</groupId>
        <artifactId>json</artifactId>
        <version>20090211</version>
    </dependency>

    <dependency>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <version>2.1</version>
    </dependency>

    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.11</version>
        <scope>test</scope>
    </dependency>

</dependencies>

В Jenkins настройки следующие:
JAVA_HOME = /Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home
MAVEN_HOME = /Applications/Jenkins/apache-maven-3.3.9
Подскажите пожалуйста, в какую сторону копать?

В сторону указания ключа для мавена для показывания расширенной информации об ошибке.

mvn -e
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects…
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.176 s
[INFO] Finished at: 2016-09-16T11:21:12+03:00
[INFO] Final Memory: 6M/123M
[INFO] ------------------------------------------------------------------------
[ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format : or :[:]:. 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 : or :[:]:. 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:497)
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] 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] NoGoalSpecifiedException - Apache Maven - Apache Software Foundation

В Jenkins указан goal - test

где указан? в ошибке же написано - что не указан гоал.

В Invoke top-level Maven targets

А где у вас в поме зависимость на junit?
https://maven.apache.org/surefire/maven-surefire-plugin/examples/junit.html

Извиняюсь, скролла не увидел - теперь вижу.

Выше привел содержимое pom

<dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.11</version>
        <scope>test</scope>
    </dependency

Ещё раз покажите полностью строку запуска тестов.
Ещё раз запустите её с ключом -e

Извините, вы имеете ввиду mvn -e test?

Дурацкий вопрос наверное… в именах классов слово test есть?

Да, из Maven тесты запускаются

Конечно.

mvn -e test
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects…
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building OrderAppAppiumMaven 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] — maven-resources-plugin:2.6:resources (default-resources) @ OrderAppAppiumMaven —
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] — maven-compiler-plugin:3.5.1:compile (default-compile) @ OrderAppAppiumMaven —
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] — maven-resources-plugin:2.6:testResources (default-testResources) @ OrderAppAppiumMaven —
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/dmitry/IdeaProjects/OrderMaven/src/test/resources
[INFO]
[INFO] — maven-compiler-plugin:3.5.1:testCompile (default-testCompile) @ OrderAppAppiumMaven —
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] — maven-surefire-plugin:2.19.1:test (default-test) @ OrderAppAppiumMaven —
[INFO] Surefire report directory: /Users/dmitry/IdeaProjects/OrderMaven/target/surefire-reports


T E S T S

Running TestsRestaurant.TestClass
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.176 sec - in TestsRestaurant.TestClass

Results :

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

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.324 s
[INFO] Finished at: 2016-09-16T11:41:56+03:00
[INFO] Final Memory: 14M/220M
[INFO] ------------------------------------------------------------------------

И в чём проблема была?
Лучше указывать что-то типа: **/Tests*.java

В дженкинсе проект не собирается

а это что?

[INFO] Scanning for projects…
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building OrderAppAppiumMaven 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] — maven-resources-plugin:2.6:resources (default-resources) @ OrderAppAppiumMaven —
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] — maven-compiler-plugin:3.5.1:compile (default-compile) @ OrderAppAppiumMaven —
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.303 s
[INFO] Finished at: 2016-09-16T11:17:06+03:00
[INFO] Final Memory: 14M/220M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (default-compile) on project MavenTest: Error while storing the mojo status: /Users/Test/IdeaProjects/MavenTest/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst (Permission denied) → [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] MojoExecutionException - Apache Maven - Apache Software Foundation
Build step ‘Invoke top-level Maven targets’ marked build as failure
Finished: FAILURE

Успешное выполнение происходит в среде, а в дженкинсе нет

Проблемы с доступом. Копайте чтобы пользователь под которым работает Дженкинс имел доступ на чтение/запись в папку где собирается/запускается проект.

1 лайк