Я пытался запустить свой проект maven в контейнер maven, но безуспешно. В windows я запускал весь свой тест со следующими командами, и он отлично работает, но в контейнере «maven: 3.6.3-jdk-8» возвращается неизвестная ошибка жизненного цикла.
mvn clean install -Ptest OR mvn test -Ptest
> [ERROR] Unknown lifecycle phase "clean install". 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]
Мой файл POM. xml.
<profiles>
<profile>
<id>test</id>
<properties>
<suiteXmlFile>${basedir}\src\test\resources\project\test.xml</suiteXmlFile>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>testMore</id>
<properties>
<suiteXmlFile>${basedir}\src\test\resources\project\testMore.xml</suiteXmlFile>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</profile>
</profiles>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.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>3.0.0-M4</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>${suiteXmlFile}</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
Моя команда dockerfile
ENTRYPOINT ["mvn", "test","-Ptest"]
ИЛИ
ENTRYPOINT ["mvn", "clean install -P test"]
Всякий раз, когда я заменяю ${suiteXmlFile}
с ${basedir}\src\test\resources\project\test.xml
и запуском ENTRYPOINT ["mvn", "test"]
контейнер выполняет все тесты, перечисленные в test. xml.
я уже проверил с помощью -Dresources = test. xml это также не работает для меня, даже я пробовал с тестом и ставил цели / фазы, но мне не повезло.