Skip to content

Commit 0afe773

Browse files
committed
update build to fix publish
1 parent 8d4d0a6 commit 0afe773

File tree

3 files changed

+46
-7
lines changed

3 files changed

+46
-7
lines changed

PUBLISH.md

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,51 @@ openpgp-revocs.d pubring.asc trustdb.gpg
9292

9393
4. In `sbt>` run `publishSigned` - a plus sign is not used since we only publish for Scala 3 from 1.2.0.
9494

95-
5. Log into Sonatype Nexus here: (if the page does not load, clear the browser's cache by pressing Ctrl+F5) https://oss.sonatype.org/#welcome
95+
Note: It is falsely said to be `sbt publish` according to https://www.scala-sbt.org/1.x/docs/Publishing.html but you need to use `sbt publishSigned`
96+
after creating a .credentials file in ~/.sbt including below where xxx and yyy is replaced with secret values that is access according to https://central.sonatype.org/publish/generate-token/ If you do just `publish` you will get an error later in the process after closing below that complains that .asc files are missing etc.
97+
98+
Put .credentials in ~/.sbt
99+
```
100+
realm=Sonatype Nexus Repository Manager
101+
host=oss.sonatype.org
102+
user=xxx
103+
password=yyy
104+
```
105+
106+
When I did publishSIgend last time I got these errors but the publishing went through anyway with the above .credentials in ~/.sbt:
107+
```
108+
sbt:introprog> publishSigned
109+
[info] Wrote /home/bjornr/git/hub/lunduniversity/introprog-scalalib/target/scala-3.3.3/introprog_3-1.4.0.pom
110+
[warn] multiple main classes detected: run 'show discoveredMainClasses' to see the list
111+
[error] gpg: Warning: not using 'E7232FE8B8357EEC786315FE821738D92B63C95F' as default key: No secret key
112+
[error] gpg: all values passed to '--default-key' ignored
113+
[error] gpg: Warning: not using 'E7232FE8B8357EEC786315FE821738D92B63C95F' as default key: No secret key
114+
[error] gpg: all values passed to '--default-key' ignored
115+
[error] gpg: Warning: not using 'E7232FE8B8357EEC786315FE821738D92B63C95F' as default key: No secret key
116+
[error] gpg: all values passed to '--default-key' ignored
117+
[error] gpg: Warning: not using 'E7232FE8B8357EEC786315FE821738D92B63C95F' as default key: No secret key
118+
[error] gpg: all values passed to '--default-key' ignored
119+
[info] published introprog_3 to https://oss.sonatype.org/service/local/staging/deploy/maven2/se/lth/cs/introprog_3/1.4.0/introprog_3-1.4.0.pom.asc
120+
[info] published introprog_3 to https://oss.sonatype.org/service/local/staging/deploy/maven2/se/lth/cs/introprog_3/1.4.0/introprog_3-1.4.0-javadoc.jar
121+
[info] published introprog_3 to https://oss.sonatype.org/service/local/staging/deploy/maven2/se/lth/cs/introprog_3/1.4.0/introprog_3-1.4.0.pom
122+
[info] published introprog_3 to https://oss.sonatype.org/service/local/staging/deploy/maven2/se/lth/cs/introprog_3/1.4.0/introprog_3-1.4.0.jar.asc
123+
[info] published introprog_3 to https://oss.sonatype.org/service/local/staging/deploy/maven2/se/lth/cs/introprog_3/1.4.0/introprog_3-1.4.0.jar
124+
[info] published introprog_3 to https://oss.sonatype.org/service/local/staging/deploy/maven2/se/lth/cs/introprog_3/1.4.0/introprog_3-1.4.0-javadoc.jar.asc
125+
[info] published introprog_3 to https://oss.sonatype.org/service/local/staging/deploy/maven2/se/lth/cs/introprog_3/1.4.0/introprog_3-1.4.0-sources.jar
126+
[info] published introprog_3 to https://oss.sonatype.org/service/local/staging/deploy/maven2/se/lth/cs/introprog_3/1.4.0/introprog_3-1.4.0-sources.jar.asc
127+
```
128+
129+
OOOPS! TODO: I already had this file: `cat ~/.sbt/sonatype_credential` pulled in by `cat ~/.sbt/1.0/sonatype.sbt` so I should remove the last of them as Credentials is now included in the build.sbt
130+
131+
5. After you have done `sbt publishSigned` then log into Sonatype Nexus here: (if the page does not load, clear the browser's cache by pressing Ctrl+F5) https://oss.sonatype.org/#welcome
96132

97133
6. Click on *Staging Repositories* in the Build Promotion list to the left. Click "Refresh" if list is empty. https://oss.sonatype.org/#stagingRepositories
98134

99135
7. Scroll down and select something similar to `selthcs-100X` and select the *Contents* tab and expand until leaf level of the tree where you can see the `introprog_3-x.y.z.jar`
100136

101137
8. Download the staged jar by clicking on it and selecting the *Artifact* tab to the right and click the Repository Path to download. Save it e.g. in `tmp`.
102138

103-
9. Verify that the staged jar downloaded from sonatype works by running `scala -cp introprog_3-x.y.z.jar` and in REPL e.g. `val w = new introprog.PixelWindow`. The reason for this step is that there has been incidents where the uploading has failed and the jar was empty. A published jar can not be retracted even if corrupted according to Sonatype policies.
139+
9. Verify that the staged jar downloaded from sonatype works by running something similar to `scala-cli repl . -S 3.4.2 --jar introprog_3-1.4.0.jar` and in REPL e.g. `val w = new introprog.PixelWindow` or `introprog.examples.TestPixelWindow.main(Array())`. The reason for this step is that there has been incidents where the uploading has failed and the jar was empty. A published jar can not be retracted even if corrupted according to Sonatype policies.
104140

105141
10. Click the *Close* icon with a diskette above the repository list to "close" the staging repository. No need to write anything in the "Description" field in the popup. It has happened that the Close failed - then the repo is still "Open" so try to close it again and hope it works this time...
106142

@@ -109,3 +145,4 @@ openpgp-revocs.d pubring.asc trustdb.gpg
109145
12. By searching here you can see the repo in progress of being published but it takes a while before it is publicly visible on Central (typically 10-15 minutes). https://oss.sonatype.org/#nexus-search;quick~se.lth.cs
110146

111147
13. When visible on Central at https://repo1.maven.org/maven2/se/lth/cs/introprog_3/ verify with a simple sbt project that it works as shown in [README usage instructions for sbt](https://github.com/lunduniversity/introprog-scalalib/blob/master/README.md#using-sbt).
148+

build.sbt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,12 @@ publishConfiguration := publishConfiguration.value.withOverwrite(true)
9595
publishLocalConfiguration := publishLocalConfiguration.value.withOverwrite(true)
9696
//pushRemoteCacheConfiguration := pushRemoteCacheConfiguration.value.withOverwrite(true)
9797

98+
credentials += Credentials(Path.userHome / ".sbt" / ".credentials")
99+
98100
//https://oss.sonatype.org/#stagingRepositories
99101
//https://oss.sonatype.org/#nexus-search;quick~se.lth.cs
100102
//https://repo1.maven.org/maven2/se/lth/cs/introprog_2.12/
101103

102-
//usePgpKeyHex("E7232FE8B8357EEC786315FE821738D92B63C95F")
103104

104-
//https://github.com/sbt/sbt-pgp
105+
//https://github.com/sbt/sbt-pgp
106+

docs/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Add these magic comment lines starting with `//>` in the beginning of your Scala
2828

2929
```
3030
//> using scala 3
31-
//> using lib "se.lth.cs::introprog:1.4.0"
31+
//> using dep "se.lth.cs::introprog:1.4.0"
3232
```
3333
You can choose the latest stable Scala version, or any version from at least Scala 3.3.3.
3434

@@ -38,7 +38,7 @@ If your program looks like this:
3838

3939
```
4040
//> using scala 3
41-
//> using lib "se.lth.cs::introprog:1.4.0"
41+
//> using dep "se.lth.cs::introprog:1.4.0"
4242
4343
@main def MyMain =
4444
val w = introprog.PixelWindow()
@@ -52,7 +52,7 @@ See: [api documentation for PixelWindow](https://fileadmin.cs.lth.se/pgk/api/api
5252

5353
### Using sbt
5454

55-
If you have [sbt](https://www.scala-sbt.org/) installed then you can put this text in a file called `build.sbt`
55+
If you have [sbt](https://www.scala-sbt.org/) installed at least version 1.10.0 then you can put this text in a file called `build.sbt`
5656

5757
```
5858
scalaVersion := "3.4.2" // or any Scala version from at least 3.3.3

0 commit comments

Comments
 (0)