티스토리 뷰
[Spring] Maven Build Fail 에러 해결 org.apache.maven.surefire:surefire-junit4:jar:2.18.1 plugin is missing the dummy.jar.
균지니 2022. 7. 16. 09:02문제
maven build install 수행 시 아래와 같은 오류가 발생하며 install이 정상적으로 동작하지 않습니다. org.apache.maven.surefire:surefire-junit4:jar:2.12.4 플러그인에 dummy.jar이 없어 빌드를 성공적으로 할 수 없다고 오류 메시지가 표시됩니다.
console error
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.852 s
[INFO] Finished at: 2022-07-13T15:01:47+09:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire- plugin:2.12.4:test (default-test) on project qds-mobile-selenium-tests: Unable to generate classpath: org.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException:
Missing:
[ERROR] ----------
[ERROR] 1) org.apache.maven.surefire:surefire-junit4:jar:2.12.4
[ERROR]
[ERROR] Try downloading the file manually from the project website.
[ERROR]
[ERROR] Then, install it using the command:
[ERROR] mvn install:install-file -DgroupId=org.apache.maven.surefire -
DartifactId=surefire-junit4 -Dversion=2.12.4 -Dpackaging=jar - Dfile=/path/to/file
[ERROR]
[ERROR] Alternatively, if you host your own repository you can deploy the
file there:
[ERROR] mvn deploy:deploy-file -DgroupId=org.apache.maven.surefire -
DartifactId=surefire-junit4 -Dversion=2.12.4 -Dpackaging=jar -
Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
[ERROR]
[ERROR] Path to dependency:
[ERROR] 1) dummy:dummy:jar:1.0
[ERROR] 2) org.apache.maven.surefire:surefire-junit4:jar:2.12.4
[ERROR]
[ERROR] ----------
[ERROR] 1 required artifact is missing.
[ERROR]
[ERROR] for artifact:
[ERROR] dummy:dummy:jar:1.0
[ERROR]
[ERROR] from the specified remote repositories:
[ERROR] company-releases (https://company.jfrog.io/company/release-local,
releases=true, snapshots=false),
[ERROR] central (https://company.jfrog.io/company/libs-release,
releases=true, snapshots=false),
[ERROR] snapshots (https://company.jfrog.io/company/libs-snapshot,
releases=true, snapshots=true)
[ERROR]
[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/MojoExecutionException
해결 방법
pom.xml에 maven-surefire-plugin 의존성을 명시해 주면 됩니다. 아래와 같은 코드를 추가하고 버전도 알맞게 써줘야 합니다. 수정 후 Reload Maven Projects → build install 하면 build 성공입니다. ㅎㅎ
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
<!-- maven-surefire-plugin 추가 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.4</version>
</plugin>
</plugins>
원인
콘솔 오류 메시지를 보니 "[ERROR] 1 required artifact is missing" 필수 artifact 1개가 누락되었습니다.라는 내용이 있었어요. pom.xml 열어보니 maven-surefire-plugin 가 명시되어 있지 않더라구요. 의존성 설정이 정확하지 않아 plugin 동작에 필요한 jar를 받아오지 못해서 발생한 오류입니다. 근본적으로 인터넷 연결이 작동하지 않는 개발환경에서는 사용자 정의 저장소의 종속성을 정확히 pom.xml에 기입해줘야 합니다. 아래는 Maven Surefire 플러그인에 대해서 알아보겠습니다.
Maven-Surefire-Plugin 이란?
Surefire 플러그인은 애플리케이션의 단위 테스트를 실행해 주는 플러그인입니다. 해당 플러그인을 쓰려면 Maven3.2.5 및 JDK1.8 이상이 스펙 기준입니다. Surefire는 JUnit 3.8.x, JUnit 4.x, JUnit 4.7의 세 가지 JUnit 세대를 지원합니다. 저자의 프로젝트 개발환경은 Maven 2.5.1, JDK1.8 사용하고 있고 Junit 4.12 버전을 사용 중이므로 Maven-Surefire-Plugin 자체에 대한 종속성으로 추가하여 플러그인 버전을 수동으로 지정했습니다.
출처 : https://maven.apache.org/surefire/maven-surefire-plugin/
Maven Surefire Plugin – Introduction
Maven Surefire Plugin Requirements: Maven 3.2.5 and JDK 1.8 or higher. The Surefire Plugin is used during the test phase of the build lifecycle to execute the unit tests of an application. It generates reports in two different file formats: Plain text file
maven.apache.org
마무리
콘솔에 Maven Build Fail 뜨면 언넝 배포하고 반영해야 되는데 뭐가 문제인지 오류 메시지 보면 처음 보는 에러문구가 있어요. pom.xml? lib 문제 있나? 인터넷이 안 되는 환경이라 문제 있으면 lib 다시 반입해야 되려나 싶은데, 이제 위와 같은 오류가 뜨면 pom.xml에 버전이나 의존성을 명확히 기입했는지 확인해야겠어요.
이상 코딩하는 지니였습니다.
- Total
- Today
- Yesterday