mirror of https://github.com/sbt/sbt.git
Add a unit test for the 'scala-jar' mapping.
This commit is contained in:
parent
0ac485feb7
commit
2ceb4f7d72
Binary file not shown.
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.test</groupId>
|
||||
<artifactId>test-artifact</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<packaging>scala-jar</packaging>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
import java.io.File
|
||||
import org.apache.ivy.core.module.descriptor.{ Artifact => IvyArtifact }
|
||||
import org.apache.ivy.core.module.id.ModuleRevisionId
|
||||
import org.apache.ivy.core.resolve.ResolveOptions
|
||||
import org.specs2.mutable.Specification
|
||||
import sbt._
|
||||
import IO.withTemporaryDirectory
|
||||
|
||||
object CustomPomParserTest extends Specification {
|
||||
|
||||
"CustomPomParser" should {
|
||||
"resolve an artifact with packaging 'scala-jar' as a regular jar file." in {
|
||||
val log = ConsoleLogger()
|
||||
withTemporaryDirectory { cacheDir =>
|
||||
val repoUrl = getClass.getResource("/test-maven-repo")
|
||||
val local = MavenRepository("Test Repo", repoUrl.toExternalForm)
|
||||
val paths = new IvyPaths(new File("."), Some(cacheDir))
|
||||
val conf = new InlineIvyConfiguration(paths, Seq(local), Nil, Nil, false, None, Seq("sha1", "md5"), None, log)
|
||||
val ivySbt = new IvySbt(conf)
|
||||
val resolveOpts = new ResolveOptions().setConfs(Array("default"))
|
||||
val mrid = ModuleRevisionId.newInstance("com.test", "test-artifact", "1.0.0-SNAPSHOT")
|
||||
|
||||
val resolveReport = ivySbt.withIvy(log) { ivy =>
|
||||
ivy.resolve(mrid, resolveOpts, true)
|
||||
}
|
||||
|
||||
resolveReport.hasError must beFalse
|
||||
resolveReport.getArtifacts.size() must beEqualTo(1)
|
||||
val artifact: IvyArtifact = resolveReport.getArtifacts.asInstanceOf[java.util.List[IvyArtifact]].get(0)
|
||||
artifact.getModuleRevisionId must beEqualTo(mrid)
|
||||
artifact.getExt must beEqualTo("jar")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue