1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
package cbt
import java.io.File
import java.net.URL
import java.nio.file.Files.readAllBytes
trait Publish extends PackageJars{
def description: String
def url: URL
def developers: Seq[Developer]
def licenses: Seq[License]
def scmUrl: String
def scmConnection: String
def inceptionYear: Int
def organization: Option[Organization]
// ========== package ==========
/** put additional xml that should go into the POM file in here */
def pom: File = lib.pom(
groupId = groupId,
artifactId = artifactId,
version = version,
scalaMajorVersion = scalaMajorVersion,
name = name,
description = description,
url = url,
developers = developers,
licenses = licenses,
scmUrl = scmUrl,
scmConnection = scmConnection,
inceptionYear,
organization,
dependencies = dependencies,
jarTarget = jarTarget
)
// ========== publish ==========
private val releaseFolder = s"/${groupId.replace(".","/")}/${artifactId}_$scalaMajorVersion/$version/"
def publishLocal: Unit =
lib.publishLocal( sourceFiles, `package` :+ pom, context.paths.mavenCache, releaseFolder )
def publishSnapshotLocal: Unit =
copy( context.copy(version = Some(version+"-SNAPSHOT")) ).publishLocal
def isSnapshot: Boolean = version.endsWith("-SNAPSHOT")
override def copy(context: Context) = super.copy(context).asInstanceOf[Publish]
}
|