You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

RELEASE.md 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. # How to release AspectJ
  2. AspectJ is built and released with Maven. As of writing this, there is a Maven wrapper in the project root folder,
  3. pointing to Maven 3.6.3, but we are going to use simple `mvn` commands instead of `./mvnw` here, assuming that there is
  4. a local Maven installation on your workstation. You can easily substitute one for the other command.
  5. When deploying final releases to Sonatype OSSRH, the build uses Nexus Staging Maven plugin instead of Maven Deploy
  6. plugin. This helps to create a staging repository for the release and later release it to Maven Central without having
  7. to log into the [Sonatype Nexus web UI](https://oss.sonatype.org/). Everything can be done from the command line.
  8. Snapshots do not need to be staged and released separately, Maven Deploy does the job in this case. so let us begin with
  9. the simple case:
  10. ## Snapshot releases
  11. To publish a snapshot, set up your credentials in `~/.m2/settings.xml` something like:
  12. ```xml
  13. <settings>
  14. <servers>
  15. <server>
  16. <id>ossrh</id>
  17. <username>USERNAME</username>
  18. <password>PASSWORD</password>
  19. </server>
  20. </servers>
  21. </settings>
  22. ```
  23. Next, you simply call:
  24. ```shell
  25. mvn clean deploy
  26. # OR: If you ran tests locally before, or the CI workflow on GitHub did
  27. mvn -DskipTests clean deploy
  28. # OR: Speed it up some more, skipping documentation generation. Depending on
  29. # your shell, you might not have to escape the '!' character for deactivating
  30. # the 'create-docs' profile. On a (Git) Bash you have to, though.
  31. mvn -P \!create-docs -DskipTests clean deploy
  32. ```
  33. This only deploys the main artifacts
  34. - AspectJ runtime `aspectjrt-[VERSION].jar`,
  35. - AspectJ tools/compiler `aspecttools-[VERSION].jar`,
  36. - AspectJ weaver `aspectjweaver-[VERSION].jar`,
  37. - AspectJ matcher `aspectjmatcher-[VERSION].jar`.
  38. The AspectJ installer (`installer/target/aspectj-[VERSION].jar`) needs to be published separately, if you wish to make
  39. it available to the public for this snapshot.
  40. To consume an AspectJ snapshot published this way, use the OSSRH repository in the dependent project's POM:
  41. ```xml
  42. <repository>
  43. <id>ossrh</id>
  44. <url>https://oss.sonatype.org/content/repositories/snapshots</url>
  45. </repository>
  46. ```
  47. ## Public releases (milestone, release candidate, final)
  48. The artifacts released are the same as for snapshots, the procedure needs a few more steps, though. I am explaining the
  49. manual versioning process without using Maven Release plugin. It might work using Maven Release too, i.e.
  50. - setting the release version in all POMs,
  51. - building a release,
  52. - running tests (can be skipped),
  53. - committing the release POMs,
  54. - tagging the release,
  55. - deploying the release,
  56. - setting the next snapshot version in all POMs,
  57. - committing the snapshot POMs,
  58. - pushing the previous commits and the release tag to the upstream Git repository.
  59. If the AspectJ release also includes support for a new Java version, then before releasing AspectJ, search for the
  60. term `AspectJ_JDK_Update` across all files in the code base, also non-Java ones. Check, that you have not forgotten to
  61. add any necessary infrastructure or to increment version numbers as appropriate.
  62. In order to show the details and give you more control over the process, you can do it step by step as follows:
  63. ```shell
  64. # Make sure we are on JDK 16, because javadoc generation is JDK version sensitive
  65. # and might throw unexpected errors on other versions
  66. java -version
  67. # java version "16" 2021-03-16 (...)
  68. # Verify that we are working on a clean working directory.
  69. # There should be no staged, unstaged or untracked files.
  70. git status
  71. # Set release version in all POMs
  72. mvn versions:set -DnewVersion=1.9.8.M2
  73. # Verify if the POM changes are OK, then remove the POM backup files
  74. mvn versions:commit
  75. # Build and deploy the release to a Nexus staging repository.
  76. # The 'release' profile will activate:
  77. # - Maven GPG plugin for signing artifacts (stand by to enter your passpharase).
  78. # On Windows, a GUI password dialogue should pop up with a recent GnuPG version.
  79. # In case of error 'Failed to execute goal org.apache.maven.plugins:maven-gpg-plugin:1.6:sign',
  80. # try 'export GPG_TTY=$(tty)' before running the command.
  81. # - Maven Javadoc plugin
  82. # - Nexus Staging Maven plugin
  83. # The 'create-docs profile will make sure to generate AspectJ docs to be included in the installer.
  84. # Optionally, use '-DskipTests', if you ran all tests before.
  85. mvn -P release,create-docs clean deploy
  86. ```
  87. If this command was successful, it means we have created a staging repository on Sonatype OSSRH, uploaded all artifacts
  88. and all pre-release checks on the Sonatype server passed, i.e. if the POMs contain all necessary information and if
  89. there are source and javadoc artifacts attached to the build. Now the only step left is to release the staging
  90. repository to Maven Central.
  91. Actually, Nexus Staging Maven plugin can also be configured deploy and release to Maven Central in a single command, but
  92. in order to give you a chance to manually download and verify the artifacts from the staging repository, the default
  93. plugin configuration in the parent POM is `<autoReleaseAfterClose>false</autoReleaseAfterClose>`. Switching the value to
  94. `true` would release straight to Maven Central, given all previous steps were successful.
  95. Before we release the staging repository though, we want to commit and tag the release, then set a new snapshot version:
  96. ```shell
  97. # Commit the release POMs to Git (better do this from your IDE, verifying the
  98. # changes before staging them for Git commit)
  99. git commit -am "Release AspectJ 1.9.8.M2"
  100. # Tag release
  101. git tag V1_9_8_M2
  102. # Set new snapshot version, increasing the version number after a final release
  103. mvn versions:set -DnewVersion=1.9.8-SNAPSHOT
  104. # Verify if the POM changes are OK, then remove the POM backup files
  105. mvn versions:commit
  106. # Commit the snapshot POMs to Git
  107. git commit -am "Set version to 1.9.8-SNAPSHOT"
  108. # Push the previous commits to GitHub
  109. git push origin
  110. # Push the release tag to GitHub
  111. git push origin V1_9_8_M2
  112. ```
  113. OK, the Git house-keeping is done. Now finally, let us enjoy the fruits of our work and release the staging repository
  114. to Maven Central:
  115. ```shell
  116. # Probably we forgot to write down the staging repository ID before.
  117. # It was written somewhere in the Maven log:
  118. # [INFO] * Created staging repository with ID "orgaspectj-1106".
  119. # [INFO] * Staging repository at https://oss.sonatype.org:443/service/local/staging/deployByRepositoryId/orgaspectj-1106
  120. # ...
  121. # [INFO] * Uploading locally staged artifacts to profile org.aspectj
  122. # [INFO] * Upload of locally staged artifacts finished.
  123. # [INFO] * Closing staging repository with ID "orgaspectj-1106".
  124. #
  125. # But it is too far to scroll up. So let us just ask Nexus, which staging
  126. # repositories there are.
  127. mvn nexus-staging:rc-list
  128. # [INFO] ID State Description
  129. # [INFO] orgaspectj-1106 CLOSED org.aspectj:aspectjrt:1.9.8.M2
  130. # Because of problems in Nexus Staging Maven Plugin with more recent JDKs,
  131. # we might need this first
  132. export MAVEN_OPTS="--add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.desktop/java.awt.font=ALL-UNNAMED"
  133. # Use the ID of the corresponding CLOSED staging repository for releasing to
  134. # Maven Central
  135. mvn nexus-staging:rc-release -DstagingRepositoryId=orgaspectj-1106
  136. ```
  137. Tadaa! We have performed an AspectJ release. In a few minutes, the artifacts should appear on Maven Central somewhere
  138. under https://repo1.maven.org/maven2/org/aspectj/, e.g. AspectJ Tools 1.9.8.M2 would appear under
  139. https://repo1.maven.org/maven2/org/aspectj/aspectjtools/1.9.8.M2/. As soon as you see the artifacts there instead of
  140. "404 not found", you can announce release availability on the AspectJ mailing list and wherever else appropriate.
  141. Finally, remember to publish the [release on GitHub](https://github.com/eclipse-aspectj/aspectj/releases), attaching
  142. the AspectJ installer (`installer/target/aspectj-[VERSION].jar`) to it.
  143. ## Publish documentation on website
  144. Content for the [AspectJ website](https://eclipse.dev/aspectj/) is maintained in GitHub repository
  145. [eclipse-aspectj/aspectj-website](https://github.com/eclipse-aspectj/aspectj-website). As of writing this, there are a
  146. few basic PHP pages (to be migrated to plain HTML by the end of 2024 when PHP support expires), but the bulk of the
  147. project documentation is generated by the AspectJ project, i.e. this project. The asciidoc content and other
  148. resources in module `docs` are transformed into what we want to publish on the website. Besides, the documentation is
  149. also packaged into the AspectJ installer and published for offline use. On top of the `docs` content, we also publish
  150. javadocs for the runtime and weaver APIs.
  151. After a full build, you can find the generated documentation including javadocs in folder `aj-build/dist/docs/doc`.
  152. Conveniently, docs are also attached to GitHub CI builds, albeit currently without javadocs. The content goes to
  153. folder `doc/latest` in the website repository or maybe to a folder named after the release, if we decide to do that in
  154. the future. Presently, we only publish the latest documentation, always overwriting the preceding version. The entry
  155. page for the generated docs is published [here](https://eclipse.dev/aspectj/doc/latest/index.html).
  156. Make sure to **check the diffs** before committing:
  157. * If a certain part of the documentation (e.g. developer's notebook, programming guide) has not changed HTML-wise,
  158. you also do not need to commit the corresponding PDF, even though it might be binarily different. But if the HTML
  159. content is unchanged, the PDF should look the same as before, too, unless you have reason to believe otherwise
  160. (e.g. changes in style in the generator options).
  161. * Depending on your local OS and Git configuration, some changes might only be caused by different line delimiters,
  162. i.e. CRLF on Windows and LF on Linux and MacOS. Please avoid committing those, changing the files back and forth.
  163. Rather run dos2unix or unix2dos on those files to eliminate unnecessary and possibly huge diffs.
  164. * You also want to identify other generic changes, such as timestamps, years in copyright notices etc. It is an
  165. ongoing process to optimise such changes away to achieve stable docs and small commit diffs. If you spot
  166. something, make sure to improve the build process accordingly.
  167. After pushing changes to the website repository, they should be published by a batch process automatically after a
  168. short delay (usually a few minutes).
  169. **Caveat:** The publishing process currently relies on fast-forwarding changes, i.e. if you e.g. amend or squash website
  170. commits and then force-push them, the changes might not be published at all, and you need to open an Eclipse helpdesk
  171. issue like [this one]() for the infrastructure team to propagate the changes manually. Knowing that, it is best not to
  172. force-push, unless absolutely necessary (e.g. removing commits with sensitive information).
  173. After the website has been published, smoke-test the changes, opening some pages you know must have changed.