diff --git a/src/main/scala/com/typesafe/sbt/pom/MavenHelper.scala b/src/main/scala/com/typesafe/sbt/pom/MavenHelper.scala index 1825656..a89a21e 100644 --- a/src/main/scala/com/typesafe/sbt/pom/MavenHelper.scala +++ b/src/main/scala/com/typesafe/sbt/pom/MavenHelper.scala @@ -190,37 +190,64 @@ object MavenHelper { def convertDep(dep: PomDependency): sbt.ModuleID = { // TODO - Handle mapping all the maven oddities into sbt's DSL. - val scopeString: Option[String] = - for { - scope <- Option(dep.getScope) - } yield scope - - def fixScope(m: ModuleID): ModuleID = - scopeString match { - case Some(scope) => m % scope - case None => m - } - + // See https://maven.apache.org/ref/3.6.3/maven-core/artifact-handlers.html for + // matrix on Maven side of attributes def addExclusions(mod: ModuleID): ModuleID = { val exclusions = dep.getExclusions.asScala exclusions.foldLeft(mod) { (mod, exclude) => mod.exclude(exclude.getGroupId, exclude.getArtifactId) } } + def addClassifier(mod: ModuleID): ModuleID = { Option(dep.getClassifier) match { case Some(_classifier) => mod classifier _classifier case None => mod } } - addExclusions(addClassifier(fixScope(dep.getGroupId % dep.getArtifactId % dep.getVersion))) + + def addConfiguration(mod: ModuleID): ModuleID = { + val mvnScope = Option(dep.getScope) + val mvnType = Option(dep.getType) + val mvnClassifier = Option(dep.getClassifier) + + (mvnScope, mvnType) match { + // test-jar + // SCOPE + case (Some(mScope), Some(mType)) if ("test-jar".equalsIgnoreCase(mType)) => + mod + .withConfigurations(Some(s"${mScope}->test")) + .intransitive + // tests + // SCOPE + case (Some(mScope), _) if (mvnClassifier.getOrElse("").equalsIgnoreCase("tests")) => + mod + .withConfigurations(Some(s"${mScope}->test")) + // SCOPE + case (Some(mScope), _) => + mod % mScope + case _ => mod + } + } + + // order does not matter + def conversion = addExclusions _ andThen addClassifier andThen addConfiguration + + conversion(ModuleID(dep.getGroupId, dep.getArtifactId, dep.getVersion)) } - + def getDependencies(pom: PomModel): Seq[ModuleID] = { for { dep <- pom.getDependencies.asScala } yield convertDep(dep) } + + /** Filters module dependencies within same group id, which results in list + * of modules this one depends on. */ + def getModuleDependencies(pom: PomModel): Seq[ModuleID] = { + val allDependencies = getDependencies(pom) + allDependencies.filter { dep => dep.organization == pom.getGroupId } + } def getPomResolvers(pom: PomModel): Seq[Resolver] = { for { diff --git a/src/main/scala/com/typesafe/sbt/pom/MavenProjectHelper.scala b/src/main/scala/com/typesafe/sbt/pom/MavenProjectHelper.scala index 9db01be..01e5d6d 100644 --- a/src/main/scala/com/typesafe/sbt/pom/MavenProjectHelper.scala +++ b/src/main/scala/com/typesafe/sbt/pom/MavenProjectHelper.scala @@ -48,7 +48,7 @@ object MavenProjectHelper { // Next flatten the list of all projects. val projects = allProjectsInTree(tree) // Create a mapping of all dependencies between projects. - val depMap = makeDependencyMap(projects) + val depMap: Map[ProjectTree, Seq[ProjectTree]] = makeDependencyMap(projects) // Helper to look up dependencies in the presence of absences. def getDepsFor(project: ProjectTree): Seq[ProjectTree] = depMap.getOrElse(project, Nil) @@ -62,11 +62,11 @@ object MavenProjectHelper { val deps = getDepsFor(project) aggregates ++ deps } - def makeProjects(toMake: Seq[ProjectTree], made: Map[ProjectTree, Project] = Map.empty): Seq[Project] = + def makeProjects(toMake: Seq[ProjectTree], made: Map[ProjectTree, (Project, ModuleID)] = Map.empty): Seq[Project] = toMake match { case current :: rest => // Make a project, and add it to the stack - val depProjects: Seq[Project] = + val depProjects: Seq[(Project, ModuleID)] = for { dep <- getDepsFor(current) depProject <- made.get(dep) @@ -77,16 +77,32 @@ object MavenProjectHelper { for { child <- children depProject <- made.get(child) - } yield depProject + } yield depProject._1 case _ => Nil } + // Prepare data: + // list of projects and their moduleIds with correct configurations, + // according to current node in POM we are processing now + val modulesMap: Map[String, Seq[ModuleID]] = + MavenHelper + .getModuleDependencies(current.model) + .groupBy { m => makeId(m.organization, m.name, m.revision) } + val projectsMap: Map[String, Seq[(Project, ModuleID)]] = depProjects.groupBy { case (p, m) => makeId(m.organization, m.name, m.revision) } + val projectsWithModules: Seq[(Project, ModuleID)] = modulesMap.keySet.map { id => + val mwc: Seq[ModuleID] = modulesMap.get(id).getOrElse(Seq.empty) + val projects: Seq[Project] = projectsMap.get(id).getOrElse(Seq.empty).map(_._1) + projects.zip(mwc) + } + .flatten + .toSeq + // TODO - Configure debugging output.... - val currentProject = ( - Project(makeProjectName(current.model,overrideRootProjectName),current.dir) + val currentProject: Project = ( + Project(makeProjectName(current.model,overrideRootProjectName), current.dir) // First pull in settings from pom settings(useMavenPom:_*) - // Now update depends on relationships - dependsOn(depProjects.map(x =>x: ClasspathDep[ProjectReference]):_*) + // Now update depends on relationships with actual configurations + dependsOn( projectsWithModules.map { case (p, m) => new ClasspathDependency(p, m.configurations) }: _* ) // Now fix aggregate relationships aggregate(aggregates.map(x => x:ProjectReference):_*) // Now remove any inter-project dependencies we pulled in from the maven pom. @@ -98,13 +114,13 @@ object MavenProjectHelper { Keys.libraryDependencies.value.filterNot { dep => val id = makeId(dep.organization, dep.name, dep.revision) depIds contains id - } - } + } + } ) - ) - makeProjects(rest, made + (current -> currentProject)) - case Nil => made.values.toSeq + val currentModule = ModuleID(current.model.getGroupId, current.model.getArtifactId, current.model.getVersion) + makeProjects(rest, made + (current -> (currentProject, currentModule))) + case Nil => made.values.map(_._1).toSeq } makeProjects(sorted) } diff --git a/src/sbt-test/reactor-pom/can-handle-classifiers-and-types/common/module1/pom.xml b/src/sbt-test/reactor-pom/can-handle-classifiers-and-types/common/module1/pom.xml new file mode 100644 index 0000000..f8c4bc4 --- /dev/null +++ b/src/sbt-test/reactor-pom/can-handle-classifiers-and-types/common/module1/pom.xml @@ -0,0 +1,31 @@ + + 4.0.0 + net.gemelen.example + module1_2.12 + 1.0 + jar + + + net.gemelen.example + example-parent_2.12 + 1.0 + ../../pom.xml + + + + module1 + + + + + org.scala-lang + scala-library + ${scala.version} + + + + + target/scala-${scala.binary.version}/classes + target/scala-${scala.binary.version}/test-classes + + diff --git a/src/sbt-test/reactor-pom/can-handle-classifiers-and-types/common/module1/src/main/java/net/gemelen/example/annotation/ExampleAnnotation1.java b/src/sbt-test/reactor-pom/can-handle-classifiers-and-types/common/module1/src/main/java/net/gemelen/example/annotation/ExampleAnnotation1.java new file mode 100644 index 0000000..917df69 --- /dev/null +++ b/src/sbt-test/reactor-pom/can-handle-classifiers-and-types/common/module1/src/main/java/net/gemelen/example/annotation/ExampleAnnotation1.java @@ -0,0 +1,8 @@ +package net.gemelen.example.annotation; + +import java.lang.annotation.*; + +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, + ElementType.CONSTRUCTOR, ElementType.LOCAL_VARIABLE, ElementType.PACKAGE}) +public @interface ExampleAnnotation1 {} diff --git a/src/sbt-test/reactor-pom/can-handle-classifiers-and-types/common/module1/src/main/scala/net/gemelen/example/annotation/ExampleAnnotation2.scala b/src/sbt-test/reactor-pom/can-handle-classifiers-and-types/common/module1/src/main/scala/net/gemelen/example/annotation/ExampleAnnotation2.scala new file mode 100644 index 0000000..fef2fd4 --- /dev/null +++ b/src/sbt-test/reactor-pom/can-handle-classifiers-and-types/common/module1/src/main/scala/net/gemelen/example/annotation/ExampleAnnotation2.scala @@ -0,0 +1,7 @@ +package net.gemelen.example.annotation + +import scala.annotation.StaticAnnotation +import scala.annotation.meta._ + +@param @field @getter @setter @beanGetter @beanSetter +class ExampleAnnotation2(version: String) extends StaticAnnotation diff --git a/src/sbt-test/reactor-pom/can-handle-classifiers-and-types/common/module1/src/test/java/net/gemelen/example/annotation/MarkerTest.java b/src/sbt-test/reactor-pom/can-handle-classifiers-and-types/common/module1/src/test/java/net/gemelen/example/annotation/MarkerTest.java new file mode 100644 index 0000000..c4cd9f4 --- /dev/null +++ b/src/sbt-test/reactor-pom/can-handle-classifiers-and-types/common/module1/src/test/java/net/gemelen/example/annotation/MarkerTest.java @@ -0,0 +1,13 @@ +package net.gemelen.example.annotation; + +import org.scalatest.TagAnnotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@TagAnnotation +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.METHOD, ElementType.TYPE}) +public @interface MarkerTest { } diff --git a/src/sbt-test/reactor-pom/can-handle-classifiers-and-types/core/pom.xml b/src/sbt-test/reactor-pom/can-handle-classifiers-and-types/core/pom.xml new file mode 100644 index 0000000..2e17f3a --- /dev/null +++ b/src/sbt-test/reactor-pom/can-handle-classifiers-and-types/core/pom.xml @@ -0,0 +1,58 @@ + + 4.0.0 + net.gemelen.example + core_2.12 + 1.0 + jar + + + net.gemelen.example + example-parent_2.12 + 1.0 + ../pom.xml + + + + core + + + + + net.gemelen.example + other_${scala.binary.version} + ${project.version} + + + net.gemelen.example + other_${scala.binary.version} + ${project.version} + tests + test + + + + net.gemelen.example + module1_${scala.binary.version} + ${project.version} + + + net.gemelen.example + module1_${scala.binary.version} + ${project.version} + tests + test-jar + test + + + + org.scala-lang + scala-library + ${scala.version} + + + + + target/scala-${scala.binary.version}/classes + target/scala-${scala.binary.version}/test-classes + + diff --git a/src/sbt-test/reactor-pom/can-handle-classifiers-and-types/core/src/main/scala/net/gemelen/example/core/Core.java b/src/sbt-test/reactor-pom/can-handle-classifiers-and-types/core/src/main/scala/net/gemelen/example/core/Core.java new file mode 100644 index 0000000..c2f707d --- /dev/null +++ b/src/sbt-test/reactor-pom/can-handle-classifiers-and-types/core/src/main/scala/net/gemelen/example/core/Core.java @@ -0,0 +1,10 @@ +package net.gemelen.example.core; + +import net.gemelen.example.annotation.ExampleAnnotation1; + +public class Core { + + @ExampleAnnotation1 + public void method() {} +} + diff --git a/src/sbt-test/reactor-pom/can-handle-classifiers-and-types/core/src/test/java/net/gemelen/example/core/JavaCoreTest.java b/src/sbt-test/reactor-pom/can-handle-classifiers-and-types/core/src/test/java/net/gemelen/example/core/JavaCoreTest.java new file mode 100644 index 0000000..86d5f62 --- /dev/null +++ b/src/sbt-test/reactor-pom/can-handle-classifiers-and-types/core/src/test/java/net/gemelen/example/core/JavaCoreTest.java @@ -0,0 +1,9 @@ +package net.gemelen.example.core; + +import net.gemelen.example.annotation.MarkerTest; + +public class JavaCoreTest { + + @MarkerTest + public void method() {} +} diff --git a/src/sbt-test/reactor-pom/can-handle-classifiers-and-types/core/src/test/scala/net/gemelen/example/core/CoreTest.scala b/src/sbt-test/reactor-pom/can-handle-classifiers-and-types/core/src/test/scala/net/gemelen/example/core/CoreTest.scala new file mode 100644 index 0000000..4270b55 --- /dev/null +++ b/src/sbt-test/reactor-pom/can-handle-classifiers-and-types/core/src/test/scala/net/gemelen/example/core/CoreTest.scala @@ -0,0 +1,11 @@ +package net.gemelen.example.core + +import net.gemelen.example.annotation.ExampleAnnotation1 +import net.gemelen.example.annotation.ExampleAnnotation2 + +class CoreTest { + + @ExampleAnnotation1 + @ExampleAnnotation2(version = "something") + def f(): Unit = {} +} diff --git a/src/sbt-test/reactor-pom/can-handle-classifiers-and-types/other/pom.xml b/src/sbt-test/reactor-pom/can-handle-classifiers-and-types/other/pom.xml new file mode 100644 index 0000000..80f7a9a --- /dev/null +++ b/src/sbt-test/reactor-pom/can-handle-classifiers-and-types/other/pom.xml @@ -0,0 +1,43 @@ + + 4.0.0 + net.gemelen.example + other_2.12 + 1.0 + jar + + + net.gemelen.example + example-parent_2.12 + 1.0 + ../pom.xml + + + + other + + + + + net.gemelen.example + module1_${scala.binary.version} + ${project.version} + + + net.gemelen.example + module1_${scala.binary.version} + ${project.version} + test-jar + test + + + org.scala-lang + scala-library + ${scala.version} + + + + + target/scala-${scala.binary.version}/classes + target/scala-${scala.binary.version}/test-classes + + diff --git a/src/sbt-test/reactor-pom/can-handle-classifiers-and-types/other/src/main/java/net/gemelen/example/other/Other.java b/src/sbt-test/reactor-pom/can-handle-classifiers-and-types/other/src/main/java/net/gemelen/example/other/Other.java new file mode 100644 index 0000000..170d99a --- /dev/null +++ b/src/sbt-test/reactor-pom/can-handle-classifiers-and-types/other/src/main/java/net/gemelen/example/other/Other.java @@ -0,0 +1,9 @@ +package net.gemelen.example.other; + +import net.gemelen.example.annotation.ExampleAnnotation1; + +public class Other { + + @ExampleAnnotation1 + public void method() {} +} diff --git a/src/sbt-test/reactor-pom/can-handle-classifiers-and-types/pom.xml b/src/sbt-test/reactor-pom/can-handle-classifiers-and-types/pom.xml new file mode 100644 index 0000000..879d7ff --- /dev/null +++ b/src/sbt-test/reactor-pom/can-handle-classifiers-and-types/pom.xml @@ -0,0 +1,203 @@ + + 4.0.0 + net.gemelen.example + example-parent_2.12 + 1.0 + pom + + + common/module1 + other + core + + + + parent + + 2.12.12 + 2.12 + 2.0.0 + 1.8 + ${java.version} + ${java.version} + 3.6.3 + 1.6.0 + prepare-package + + + + + + org.scalatest + scalatest_${scala.binary.version} + 3.2.0 + test + + + + net.gemelen.example + other_${scala.binary.version} + + + net.gemelen.example + module1_${scala.binary.version} + + + + + + + org.scala-lang + scala-library + ${scala.version} + + + org.scalatest + scalatest_${scala.binary.version} + test + + + + + + + + net.alchim31.maven + scala-maven-plugin + 4.3.0 + + + eclipse-add-source + + add-source + + + + scala-compile-first + + compile + + + + scala-test-compile-first + + testCompile + + + + + ${scala.version} + true + true + incremental + true + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + ${java.version} + ${java.version} + true + true + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.0.0-M3 + + + **/*Test.java + + ${project.build.directory}/surefire-reports + false + false + + + + test + + test + + + + + + + org.scalatest + scalatest-maven-plugin + ${scalatest-maven-plugin.version} + + + test + + test + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.1.2 + + target/scala-${scala.binary.version}/test-classes + + + + org.apache.maven.plugins + maven-source-plugin + 3.1.0 + + true + + + + create-source-jar + + jar-no-fork + test-jar-no-fork + + + + + + + + + + net.alchim31.maven + scala-maven-plugin + + + org.apache.maven.plugins + maven-surefire-plugin + + + org.scalatest + scalatest-maven-plugin + + + org.apache.maven.plugins + maven-jar-plugin + + + prepare-test-jar + ${build.testJarPhase} + + test-jar + + + + + + org.apache.maven.plugins + maven-source-plugin + + + + diff --git a/src/sbt-test/reactor-pom/can-handle-classifiers-and-types/project/TestBuild.scala b/src/sbt-test/reactor-pom/can-handle-classifiers-and-types/project/TestBuild.scala new file mode 100644 index 0000000..c5e5a7d --- /dev/null +++ b/src/sbt-test/reactor-pom/can-handle-classifiers-and-types/project/TestBuild.scala @@ -0,0 +1,4 @@ +import sbt._ + +object ComplexBuild extends com.typesafe.sbt.pom.PomBuild + diff --git a/src/sbt-test/reactor-pom/can-handle-classifiers-and-types/project/plugins.sbt b/src/sbt-test/reactor-pom/can-handle-classifiers-and-types/project/plugins.sbt new file mode 100644 index 0000000..1094e18 --- /dev/null +++ b/src/sbt-test/reactor-pom/can-handle-classifiers-and-types/project/plugins.sbt @@ -0,0 +1 @@ +addSbtPlugin("com.typesafe.sbt" % "sbt-pom-reader" % sys.props("project.version")) diff --git a/src/sbt-test/reactor-pom/can-handle-classifiers-and-types/test b/src/sbt-test/reactor-pom/can-handle-classifiers-and-types/test new file mode 100644 index 0000000..f8fae31 --- /dev/null +++ b/src/sbt-test/reactor-pom/can-handle-classifiers-and-types/test @@ -0,0 +1,2 @@ +> parent/compile +> parent/Test/compile diff --git a/src/sbt-test/reactor-pom/cannot-handle-classifiers-and-types/common/module1/pom.xml b/src/sbt-test/reactor-pom/cannot-handle-classifiers-and-types/common/module1/pom.xml new file mode 100644 index 0000000..f8c4bc4 --- /dev/null +++ b/src/sbt-test/reactor-pom/cannot-handle-classifiers-and-types/common/module1/pom.xml @@ -0,0 +1,31 @@ + + 4.0.0 + net.gemelen.example + module1_2.12 + 1.0 + jar + + + net.gemelen.example + example-parent_2.12 + 1.0 + ../../pom.xml + + + + module1 + + + + + org.scala-lang + scala-library + ${scala.version} + + + + + target/scala-${scala.binary.version}/classes + target/scala-${scala.binary.version}/test-classes + + diff --git a/src/sbt-test/reactor-pom/cannot-handle-classifiers-and-types/common/module1/src/main/java/net/gemelen/example/annotation/ExampleAnnotation1.java b/src/sbt-test/reactor-pom/cannot-handle-classifiers-and-types/common/module1/src/main/java/net/gemelen/example/annotation/ExampleAnnotation1.java new file mode 100644 index 0000000..917df69 --- /dev/null +++ b/src/sbt-test/reactor-pom/cannot-handle-classifiers-and-types/common/module1/src/main/java/net/gemelen/example/annotation/ExampleAnnotation1.java @@ -0,0 +1,8 @@ +package net.gemelen.example.annotation; + +import java.lang.annotation.*; + +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, + ElementType.CONSTRUCTOR, ElementType.LOCAL_VARIABLE, ElementType.PACKAGE}) +public @interface ExampleAnnotation1 {} diff --git a/src/sbt-test/reactor-pom/cannot-handle-classifiers-and-types/common/module1/src/main/scala/net/gemelen/example/annotation/ExampleAnnotation2.scala b/src/sbt-test/reactor-pom/cannot-handle-classifiers-and-types/common/module1/src/main/scala/net/gemelen/example/annotation/ExampleAnnotation2.scala new file mode 100644 index 0000000..fef2fd4 --- /dev/null +++ b/src/sbt-test/reactor-pom/cannot-handle-classifiers-and-types/common/module1/src/main/scala/net/gemelen/example/annotation/ExampleAnnotation2.scala @@ -0,0 +1,7 @@ +package net.gemelen.example.annotation + +import scala.annotation.StaticAnnotation +import scala.annotation.meta._ + +@param @field @getter @setter @beanGetter @beanSetter +class ExampleAnnotation2(version: String) extends StaticAnnotation diff --git a/src/sbt-test/reactor-pom/cannot-handle-classifiers-and-types/common/module1/src/test/java/net/gemelen/example/annotation/MarkerTest.java b/src/sbt-test/reactor-pom/cannot-handle-classifiers-and-types/common/module1/src/test/java/net/gemelen/example/annotation/MarkerTest.java new file mode 100644 index 0000000..c4cd9f4 --- /dev/null +++ b/src/sbt-test/reactor-pom/cannot-handle-classifiers-and-types/common/module1/src/test/java/net/gemelen/example/annotation/MarkerTest.java @@ -0,0 +1,13 @@ +package net.gemelen.example.annotation; + +import org.scalatest.TagAnnotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@TagAnnotation +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.METHOD, ElementType.TYPE}) +public @interface MarkerTest { } diff --git a/src/sbt-test/reactor-pom/cannot-handle-classifiers-and-types/core/pom.xml b/src/sbt-test/reactor-pom/cannot-handle-classifiers-and-types/core/pom.xml new file mode 100644 index 0000000..2e17f3a --- /dev/null +++ b/src/sbt-test/reactor-pom/cannot-handle-classifiers-and-types/core/pom.xml @@ -0,0 +1,58 @@ + + 4.0.0 + net.gemelen.example + core_2.12 + 1.0 + jar + + + net.gemelen.example + example-parent_2.12 + 1.0 + ../pom.xml + + + + core + + + + + net.gemelen.example + other_${scala.binary.version} + ${project.version} + + + net.gemelen.example + other_${scala.binary.version} + ${project.version} + tests + test + + + + net.gemelen.example + module1_${scala.binary.version} + ${project.version} + + + net.gemelen.example + module1_${scala.binary.version} + ${project.version} + tests + test-jar + test + + + + org.scala-lang + scala-library + ${scala.version} + + + + + target/scala-${scala.binary.version}/classes + target/scala-${scala.binary.version}/test-classes + + diff --git a/src/sbt-test/reactor-pom/cannot-handle-classifiers-and-types/core/src/main/scala/net/gemelen/example/core/Core.java b/src/sbt-test/reactor-pom/cannot-handle-classifiers-and-types/core/src/main/scala/net/gemelen/example/core/Core.java new file mode 100644 index 0000000..c2f707d --- /dev/null +++ b/src/sbt-test/reactor-pom/cannot-handle-classifiers-and-types/core/src/main/scala/net/gemelen/example/core/Core.java @@ -0,0 +1,10 @@ +package net.gemelen.example.core; + +import net.gemelen.example.annotation.ExampleAnnotation1; + +public class Core { + + @ExampleAnnotation1 + public void method() {} +} + diff --git a/src/sbt-test/reactor-pom/cannot-handle-classifiers-and-types/core/src/test/java/net/gemelen/example/core/JavaCoreTest.java b/src/sbt-test/reactor-pom/cannot-handle-classifiers-and-types/core/src/test/java/net/gemelen/example/core/JavaCoreTest.java new file mode 100644 index 0000000..86d5f62 --- /dev/null +++ b/src/sbt-test/reactor-pom/cannot-handle-classifiers-and-types/core/src/test/java/net/gemelen/example/core/JavaCoreTest.java @@ -0,0 +1,9 @@ +package net.gemelen.example.core; + +import net.gemelen.example.annotation.MarkerTest; + +public class JavaCoreTest { + + @MarkerTest + public void method() {} +} diff --git a/src/sbt-test/reactor-pom/cannot-handle-classifiers-and-types/core/src/test/scala/net/gemelen/example/core/CoreTest.scala b/src/sbt-test/reactor-pom/cannot-handle-classifiers-and-types/core/src/test/scala/net/gemelen/example/core/CoreTest.scala new file mode 100644 index 0000000..4270b55 --- /dev/null +++ b/src/sbt-test/reactor-pom/cannot-handle-classifiers-and-types/core/src/test/scala/net/gemelen/example/core/CoreTest.scala @@ -0,0 +1,11 @@ +package net.gemelen.example.core + +import net.gemelen.example.annotation.ExampleAnnotation1 +import net.gemelen.example.annotation.ExampleAnnotation2 + +class CoreTest { + + @ExampleAnnotation1 + @ExampleAnnotation2(version = "something") + def f(): Unit = {} +} diff --git a/src/sbt-test/reactor-pom/cannot-handle-classifiers-and-types/other/pom.xml b/src/sbt-test/reactor-pom/cannot-handle-classifiers-and-types/other/pom.xml new file mode 100644 index 0000000..80f7a9a --- /dev/null +++ b/src/sbt-test/reactor-pom/cannot-handle-classifiers-and-types/other/pom.xml @@ -0,0 +1,43 @@ + + 4.0.0 + net.gemelen.example + other_2.12 + 1.0 + jar + + + net.gemelen.example + example-parent_2.12 + 1.0 + ../pom.xml + + + + other + + + + + net.gemelen.example + module1_${scala.binary.version} + ${project.version} + + + net.gemelen.example + module1_${scala.binary.version} + ${project.version} + test-jar + test + + + org.scala-lang + scala-library + ${scala.version} + + + + + target/scala-${scala.binary.version}/classes + target/scala-${scala.binary.version}/test-classes + + diff --git a/src/sbt-test/reactor-pom/cannot-handle-classifiers-and-types/other/src/main/java/net/gemelen/example/other/Other.java b/src/sbt-test/reactor-pom/cannot-handle-classifiers-and-types/other/src/main/java/net/gemelen/example/other/Other.java new file mode 100644 index 0000000..170d99a --- /dev/null +++ b/src/sbt-test/reactor-pom/cannot-handle-classifiers-and-types/other/src/main/java/net/gemelen/example/other/Other.java @@ -0,0 +1,9 @@ +package net.gemelen.example.other; + +import net.gemelen.example.annotation.ExampleAnnotation1; + +public class Other { + + @ExampleAnnotation1 + public void method() {} +} diff --git a/src/sbt-test/reactor-pom/cannot-handle-classifiers-and-types/pom.xml b/src/sbt-test/reactor-pom/cannot-handle-classifiers-and-types/pom.xml new file mode 100644 index 0000000..879d7ff --- /dev/null +++ b/src/sbt-test/reactor-pom/cannot-handle-classifiers-and-types/pom.xml @@ -0,0 +1,203 @@ + + 4.0.0 + net.gemelen.example + example-parent_2.12 + 1.0 + pom + + + common/module1 + other + core + + + + parent + + 2.12.12 + 2.12 + 2.0.0 + 1.8 + ${java.version} + ${java.version} + 3.6.3 + 1.6.0 + prepare-package + + + + + + org.scalatest + scalatest_${scala.binary.version} + 3.2.0 + test + + + + net.gemelen.example + other_${scala.binary.version} + + + net.gemelen.example + module1_${scala.binary.version} + + + + + + + org.scala-lang + scala-library + ${scala.version} + + + org.scalatest + scalatest_${scala.binary.version} + test + + + + + + + + net.alchim31.maven + scala-maven-plugin + 4.3.0 + + + eclipse-add-source + + add-source + + + + scala-compile-first + + compile + + + + scala-test-compile-first + + testCompile + + + + + ${scala.version} + true + true + incremental + true + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + ${java.version} + ${java.version} + true + true + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.0.0-M3 + + + **/*Test.java + + ${project.build.directory}/surefire-reports + false + false + + + + test + + test + + + + + + + org.scalatest + scalatest-maven-plugin + ${scalatest-maven-plugin.version} + + + test + + test + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.1.2 + + target/scala-${scala.binary.version}/test-classes + + + + org.apache.maven.plugins + maven-source-plugin + 3.1.0 + + true + + + + create-source-jar + + jar-no-fork + test-jar-no-fork + + + + + + + + + + net.alchim31.maven + scala-maven-plugin + + + org.apache.maven.plugins + maven-surefire-plugin + + + org.scalatest + scalatest-maven-plugin + + + org.apache.maven.plugins + maven-jar-plugin + + + prepare-test-jar + ${build.testJarPhase} + + test-jar + + + + + + org.apache.maven.plugins + maven-source-plugin + + + + diff --git a/src/sbt-test/reactor-pom/cannot-handle-classifiers-and-types/project/TestBuild.scala b/src/sbt-test/reactor-pom/cannot-handle-classifiers-and-types/project/TestBuild.scala new file mode 100644 index 0000000..c5e5a7d --- /dev/null +++ b/src/sbt-test/reactor-pom/cannot-handle-classifiers-and-types/project/TestBuild.scala @@ -0,0 +1,4 @@ +import sbt._ + +object ComplexBuild extends com.typesafe.sbt.pom.PomBuild + diff --git a/src/sbt-test/reactor-pom/cannot-handle-classifiers-and-types/project/plugins.sbt b/src/sbt-test/reactor-pom/cannot-handle-classifiers-and-types/project/plugins.sbt new file mode 100644 index 0000000..cac9175 --- /dev/null +++ b/src/sbt-test/reactor-pom/cannot-handle-classifiers-and-types/project/plugins.sbt @@ -0,0 +1 @@ +addSbtPlugin("com.typesafe.sbt" % "sbt-pom-reader" % "2.1.0") diff --git a/src/sbt-test/reactor-pom/cannot-handle-classifiers-and-types/test b/src/sbt-test/reactor-pom/cannot-handle-classifiers-and-types/test new file mode 100644 index 0000000..b6fb6f9 --- /dev/null +++ b/src/sbt-test/reactor-pom/cannot-handle-classifiers-and-types/test @@ -0,0 +1,3 @@ +# run test and expect failure +> parent/compile +-> parent/Test/compile