스칼라 코드를 사용하는 Maven 프로젝트를 가지고 있고 다른 스칼라 버전 (2.10.6 및 2.11.8)을 기반으로 두 개의 jar 파일을 생성하려고합니다. 만약 누군가가 단일 maven 설치 실행에서 이것을 달성 할 수있는 방법을 제안하거나 Maven 플러그 인을 사용하여이를 Maven에서 구현하는 다른 방법이 있다면다른 스칼라 버전을 사용하여 동일한 Maven 프로젝트의 두 개의 jar 파일 생성
0
A
답변
1
여러 번 실행하여이 문제를 해결할 수 있습니다.
<build>
<plugins>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<id>scala-version-2.10</id>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
<configuration>
<scalaVersion>2.10.6</scalaVersion>
<outputDir>${project.build.outputDirectory}/scala-2.10</outputDir>
</configuration>
</execution>
<execution>
<id>scala-version-2.11</id>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
<configuration>
<scalaVersion>2.11.8</scalaVersion>
<outputDir>${project.build.outputDirectory}/scala-2.11</outputDir>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>scala-2.10</id>
<goals>
<goal>jar</goal>
</goals>
<phase>package</phase>
<configuration>
<classifier>scala-2.10</classifier>
<excludes>
<exclude>scala-2.11/**</exclude>
<exclude>sparkScala/**</exclude>
<exclude>sparksql/**</exclude>
<exclude>*.timestamp</exclude>
</excludes>
</configuration>
</execution>
<execution>
<id>scala-2.11</id>
<goals>
<goal>jar</goal>
</goals>
<phase>package</phase>
<configuration>
<classifier>scala-2.11</classifier>
<excludes>
<exclude>scala-2.10/**</exclude>
<exclude>sparkScala/**</exclude>
<exclude>sparksql/**</exclude>
<exclude>*.timestamp</exclude>
</excludes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
1
다른 버전의 Scala에 대해 종속성을 갖는 프로파일을 생성하십시오 . 두 프로필 모두에서 mvn install
을 실행해야합니다. 자세한 내용은 다음을 참조하십시오. different-dependencies-for-different-build-profiles-in-maven
또한이 두 가지를 구별하기 위해 프로필의 이슈 이름/버전을 변경해야합니다.
관련 문제
- 1. 두 프로젝트의 Maven 구성
- 2. Maven 프로젝트의 스칼라 jar : org.mongodb : casbah_2.12 : jar : 3.1.1
- 3. TYCHO maven 빌드가 두 개의 다른 org.slf4j.api 버전을 포함합니다.
- 4. 다른 프로젝트의 테스트를위한 Maven building jar.
- 5. Maven 어셈블리 : 동일한 이슈의 다른 버전을 추가하십시오.
- 6. Eclipse, maven, spring 프로젝트의 jar
- 7. 두 개의 별도 JAR (Maven 포함)
- 8. 여러 Maven 미러를 사용하여 다른 jar 버전을 프로젝트로 가져 오기
- 9. git는 동일한 프로젝트의 두 버전을 각기 다른 사용자와 함께 유지합니다.
- 10. Maven에서 다른 Maven 프로젝트의 JAR 파일을 포함하는 방법
- 11. 동일한 iPhone 프로젝트의 다른 버전을 설치 하시겠습니까?
- 12. SonarQube는 동일한 프로젝트의 버전을 비교합니다
- 13. 그라디언트를 사용하여 LibGDX 프로젝트의 애셋을 연결하는 JAR 파일 생성
- 14. 모든 소스가있는 maven 프로젝트의 jar 생성하기
- 15. Maven jar 파일 편집
- 16. 스칼라 인수가있는 JAR 파일
- 17. Maven/Proguard를 사용하여 두 개의 JAR 파일을 난독 화합니다.
- 18. 한 Maven 프로젝트의 빌드를 다른 Maven 프로젝트의 빌드에 어떻게 추가합니까?
- 19. Maven : 충돌 jar 종속성
- 20. 동일한 프로젝트의 두 개의 서로 다른 APK를 가지고 있습니다.
- 21. Maven 프로젝트의 .jar 파일에 외부 .exe 파일 포함
- 22. SVN이 동일한 프로젝트의 여러 버전을 관리합니다.
- 23. Eclipse에서 프로젝트의 스칼라 버전을 선택할 수 있습니까?
- 24. 스칼라 : 두 개의 다른 클래스, 동일한 메소드의 인스턴스
- 25. IntelliJ : Maven Java 프로젝트의 파일 검색에서 .class 파일 숨기기
- 26. 넥서스에있는 두 개의 다른 리포지토리에 동일한 병이 들어 있습니다.
- 27. 스칼라 프로젝트의 환경 속성 파일
- 28. Maven - 생성 JAR GPG 서명
- 29. 이클립스 프로젝트의 JAR 파일 폴더
- 30. maven 프로젝트의 명령 줄에서 jar 파일을 실행하십시오.