Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pom] Site still did not release, add scm data to allow it to occur #905

Merged
merged 1 commit into from
Jun 5, 2024

Conversation

hazendaz
Copy link
Member

@hazendaz hazendaz commented Jun 5, 2024

actual issue is all the overrides on release that are not needed. Fall to scm as that is the standard way maven suggests now even though release wants site. Reduced version of what I use in hazendaz/base-parent just enough to get it to go. The release still won't do it but left instructions on here to do this on demand. Takes maybe minute or two. Site is now updated which is an improvement. This alone below will do nothing without running the commands listed.

actual issue is all the overrides on release that are not needed.  Fall to scm as that is the standard way maven suggests now even though release wants site.  The release still won't do it but left instructiosn on here to do this on demand.  Takes maybe minute or two.
@hazendaz hazendaz self-assigned this Jun 5, 2024
@hazendaz hazendaz added this to the 2.24.1 milestone Jun 5, 2024
@hazendaz hazendaz merged commit 9c87aa7 into revelc:main Jun 5, 2024
12 checks passed
@ctubbsii
Copy link
Member

This method of publishing is overly complex for my tastes, and there are a few things that I think are outright wrong with it.

I have set up the GitHub plugin for publishing to gh-pages in the parent POM. After a release tag is made, all you have to do is check out the tag and run mvn site-deploy without any of these changes. The only requirement is that you set up your GitHub credentials in your ~/.m2/settings.xml file using an OAuth token. This is my preferred method of publishing the sites to code.revelc.net, and what I've standardized in the parent POM.

See https://github.com/github/maven-plugins?tab=readme-ov-file#site-plugin

The site lifecycle will execute site:site to build the site and publish it in the target/site. I have the GitHub site plugin bound to the site-deploy phase of the site lifecycle, so it works as expected according to the Maven conventions using the pre-defined site lifecycle.

However, this PR changes the way I've set it up so that site deployment is done outside the site lifecycle, manually through direct use of specific plugins on the command line. It also adds some additional unnecessary steps. The site goal is the done the same (will run site:site), but then there's an unnecessary staging step that merely copies target/site to target/staging by calling site:stage which could be skipped if the scmpublish plugin was configured to use target/site instead of the default target/staging. Then, you have to call the scmpublish plugin to directly publish to the URL in the distributionManagement section. So, now you need configuration for that plus your credentials (setting up the credentials is similar, at least, but I'm not sure if this scmplugin will use ssh-agent correctly so I can keep the passphrases to my ssh keys secure... last I checked it didn't). This gets additionally confusing because the scmpublish plugin reuses this section which is set up for maven-site-plugin (the URL is read by maven-site-plugin:stage-deploy). But, it uses the scm: prefix so maven-site-plugin doesn't understand the <url>. So, this way of doing things is kind of a mix of conventions established by maven-site-plugin and conflicting conventions established by the scmpublish plugin. Plus, this way of doing things doesn't account for the GitHub-specific publish thing of adding the .nojekyll file in the gh-pages branch that is required to bypass the GitHub jekyll build, which is slow and unnecessary, and could cause compatibility problems with the static site generation done by maven-site-plugin.

If we really want to use the scmpublish plugin instead of GitHub's own, I'd be okay with switching over, but it needs to be done very differently than what this PR is doing in order to get everything working smoothly. Personally, I'd just prefer to keep things the way they are set up using GitHub's own plugin, which just works. If we were to switch, these things would need to be done first:

  1. Don't use the distributionManagement section that maven-site-plugin expects to be able to use. Instead, configure the scmpublish plugin url directly using that plugin's own configuration instead of reusing the configuration intended for use with maven-site-plugin.
  2. Specify the source directory directly in the plugin configuration, rather than add the wasteful step of copying target/site to target/staging.
  3. Add an extra step to the site build to create the .nojekyll file
  4. Bind it to the site-deploy phase of the site lifecycle, so that one can follow the normal build conventions instead of running things manually.

Again, personally, I think it's better to leave things as they are, though, using the method I set up in the parent POM.

To set it up, all you have to do is add an OAuth token in your ~/.m2/settings.xml file. You can go to https://github.com/settings/tokens to create the token (mine grants "read:org, repo, user:email") and set up your token using the <id>github</id>, like:

<servers>
  <server>
    <id>github</id>
    <password>{your encrypted OAuth2 token here}</password>
  </server>
 </servers>

@ctubbsii
Copy link
Member

So, I'm going to revert these changes for now. If we want to set it up differently in the parent POM, we can do that. Otherwise, I suggest manually running the scmpublish plugin on the command line, if you prefer to do it that way, but pass all of its configuration options on the command-line also, instead of altering the POM. Having two different methods baked into the POMs to do the same thing leaves everything very confusing. And, you can still use your preferred approach without altering the POM at all.

Another alternative is to just run mvn site:site, checkout the gh-pages branch, and manually move over the target/site directory. It's slightly more tedious, but still pretty easy to do without making any changes to the POM that conflict with the parent POM's way of publishing the site.

@hazendaz
Copy link
Member Author

Feel free to do as you please here. I simply followed exactly what maven has moved to doing over last 2 years.

@ctubbsii
Copy link
Member

I don't want to make it harder for you to do the site deploys when you need to, though. So, while I'd like to scrub this for now, I'd like to revisit this and see if we can come up with something better... something more intuitive and easier for both of us to use (and anybody else, too, if they come along and volunteer to help).

ctubbsii added a commit to ctubbsii/formatter-maven-plugin that referenced this pull request Jul 17, 2024
* Update maven build to use revelc prefixed property name for formatting
  profiles in the parent POM
* Drop the sonatype deploy snapshot configuration (not needed and not
  safe to use personal individual credentials on a shared repository
  this way - personal secrets still need to be deleted from the GitHub
  repository); discussed on revelc#889
* Re-drop autogenerated CHANGELOG file and related README in favor of
  adding a link to the milestone or full changeset in the GitHub
  release notes; discussion on revelc#844
* Bump snapshot version to 2.25.0 and update the compatible Eclipse
  version in the site documentation
* Add missing scm section (revelc/revelc#12)
* Drop site-specific distributionManagement section and related
  scmpublish plugin settings (those can be run manually entirely from
  the command-line with command-line parameters, if needed, but it
  shouldn't be necessary if the GitHub plugin defined in the site-deploy
  phase of the site lifecyle is used, as defined in the parent POM);
  discussed on revelc#905
* Revert to using stable versions of maven site plugin and Fluido skin,
  defined in the parent POM, rather than override here (when these get
  stable releases, the parent POM can be updated, and then the site
  descriptor will need to be updated, but for now, these can use the
  latest stable versions)
* Add dependencyConvergence rule to the build, and exclude conflicting
  transitive dependencies, in order to affix them to specific versions
  (some of this might not be needed once some of the other plugins start
  doing dependency convergence also, like xml-formatter and jsdt-core)
* Make sure slf4j-api is marked as provided (address concerns from revelc#846)
  It would be easier if we could converge on what maven-core or
  maven-plugin-api uses, but those dependencies are opaque to us, so we
  just have to assume it's provided and compatible with what we're
  using; slf4j has a high degree of compatibility, though, so this
  shouldn't be much of a concern
* Drop plexus-xml dependency (we don't use it, and the one that comes
  with plexus-resources is fine with Maven 3); see comment on revelc#851
@ctubbsii ctubbsii mentioned this pull request Jul 17, 2024
ctubbsii added a commit that referenced this pull request Jul 26, 2024
* Update maven build to use revelc prefixed property name for formatting
  profiles in the parent POM
* Drop the sonatype deploy snapshot configuration (not needed and not
  safe to use personal individual credentials on a shared repository
  this way - personal secrets still need to be deleted from the GitHub
  repository); discussed on #889
* Re-drop autogenerated CHANGELOG file and related README in favor of
  adding a link to the milestone or full changeset in the GitHub
  release notes; discussion on #844
* Bump snapshot version to 2.25.0 and update the compatible Eclipse
  version in the site documentation
* Add missing scm section (revelc/revelc#12)
* Drop site-specific distributionManagement section and related
  scmpublish plugin settings (those can be run manually entirely from
  the command-line with command-line parameters, if needed, but it
  shouldn't be necessary if the GitHub plugin defined in the site-deploy
  phase of the site lifecyle is used, as defined in the parent POM);
  discussed on #905
* Revert to using stable versions of maven site plugin and Fluido skin,
  defined in the parent POM, rather than override here (when these get
  stable releases, the parent POM can be updated, and then the site
  descriptor will need to be updated, but for now, these can use the
  latest stable versions)
* Add dependencyConvergence rule to the build, and exclude conflicting
  transitive dependencies, in order to affix them to specific versions
  (some of this might not be needed once some of the other plugins start
  doing dependency convergence also, like xml-formatter and jsdt-core)
* Make sure slf4j-api is marked as provided (address concerns from #846)
  It would be easier if we could converge on what maven-core or
  maven-plugin-api uses, but those dependencies are opaque to us, so we
  just have to assume it's provided and compatible with what we're
  using; slf4j has a high degree of compatibility, though, so this
  shouldn't be much of a concern
* Drop plexus-xml dependency (we don't use it, and the one that comes
  with plexus-resources is fine with Maven 3); see comment on #851
* Upload build logs on GitHub Actions failure

Try to make the build windows-friendly

* Treat test files as binaries, so git won't mangle the line endings
* Make sortpom-maven-plugin ignore line endings when verifying
* Commit correct CRLF line endings for AnyClassCRLF.java and someFile.xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants