Skip to content

Commit 0959a59

Browse files
committed
Merge pull request #51 from daniel-trinh/daniel-trinh/49-cli-to-maven
Publish cli standalone jar to maven
2 parents 264b742 + 0d3c996 commit 0959a59

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

README.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ Packaging an executable JAR
2222

2323
If you would like to package scalariform for use on the command line with java -jar, clone the repo and perform the following simple steps: ::
2424

25-
sbt one-jar
25+
sbt "project cli" "assembly"
2626

2727
sbt will build one jar with all the dependencies and put it in ::
2828

29-
cli/target/scala-$your_scala_version/scalariform.jar
29+
cli/target/scala-$your_scala_version/cli-assembly-$scalariform_version.jar
3030

3131
You can copy this to a location in your path and execute it as follows: ::
3232

33-
java -jar /home/me/bin/scalariform.jar -f -q +compactControlReadability +alignParameters +alignSingleLineCaseStatements +doubleIndentClassDeclaration +preserveDanglingCloseParenthesis +rewriteArrowSymbols +preserveSpaceBeforeArguments --stdout ~/myproject/src/main/scala/Stuff.scala > Stuff.scala
33+
java -jar /home/me/bin/cli-assembly-$scalariform_version.jar -f -q +compactControlReadability +alignParameters +alignSingleLineCaseStatements +doubleIndentClassDeclaration +preserveDanglingCloseParenthesis +rewriteArrowSymbols +preserveSpaceBeforeArguments --stdout ~/myproject/src/main/scala/Stuff.scala > Stuff.scala
3434

3535
Integration with sbt
3636
--------------------

project/Build.scala

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import sbt._
22
import sbt.Keys._
3-
import com.github.retronym.SbtOneJar
43
import com.typesafe.sbteclipse.core.EclipsePlugin.EclipseKeys._
54
import com.typesafe.sbteclipse.core.EclipsePlugin._
65
import com.typesafe.sbt.SbtScalariform
76
import com.typesafe.sbt.SbtScalariform.ScalariformKeys
87
import scalariform.formatter.preferences._
98
import xerial.sbt.Sonatype._
109
import xerial.sbt.Sonatype.SonatypeKeys._
10+
import sbtassembly.AssemblyPlugin.autoImport._
1111

1212
object ScalariformBuild extends Build {
1313

@@ -93,13 +93,17 @@ object ScalariformBuild extends Build {
9393
else
9494
Some("releases" at "https://oss.sonatype.org/service/local/staging/deploy/maven2")
9595

96-
lazy val cli = Project("cli", file("cli"), settings = subprojectSettings ++ SbtOneJar.oneJarSettings ++
96+
lazy val cli = Project("cli", file("cli"), settings = subprojectSettings ++
9797
Seq(
9898
libraryDependencies += "commons-io" % "commons-io" % "1.4",
9999
mainClass in (Compile, packageBin) := Some("scalariform.commandline.Main"),
100-
artifactName in SbtOneJar.oneJar := { (version: ScalaVersion, module: ModuleID, artifact: Artifact) "scalariform.jar" },
101-
publish := (),
102-
publishLocal := ())) dependsOn (scalariform)
100+
mainClass in assembly := Some("scalariform.commandline.Main"),
101+
artifact in (Compile, assembly) := {
102+
val art = (artifact in (Compile, assembly)).value
103+
art.copy(`classifier` = Some("assembly"))
104+
}
105+
) ++ addArtifact(artifact in (Compile, assembly), assembly)
106+
) dependsOn (scalariform)
103107

104108
lazy val misc: Project = Project("misc", file("misc"), settings = subprojectSettings ++
105109
Seq(

project/plugins.sbt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
resolvers += Classpaths.typesafeReleases
22

3-
addSbtPlugin("com.github.retronym" % "sbt-onejar" % "0.8")
4-
53
resolvers += Classpaths.typesafeSnapshots
64

75
addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.4.0")
@@ -14,4 +12,6 @@ addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.3.0")
1412

1513
addSbtPlugin("org.xerial.sbt" % "sbt-sonatype" % "0.2.1")
1614

15+
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.13.0")
16+
1717
retrieveManaged := true

0 commit comments

Comments
 (0)