Skip to content

Conversation

@lhotari
Copy link
Member

@lhotari lhotari commented Apr 23, 2021

Motivation

"core-modules" profile is broken on JDK11. core-modules profile allows building a subset of the modules. It is used in the unit test builds.
The current Pulsar build is designed in a way that main profile shouldn't be active when core-modules or docker profile is active.

Modifications

  • Fix the usages of core-modules and docker profiles so that the main profile is explicitly de-activated from the command line by passing -main (same as !main, but doesn't require quotes in a unix shell) to the list of profiles for -P on the maven command line.

    • For example:
      • -Pcore-modules,-main to activate core-modules
      • -Pdocker,-main to activate the docker profile.
  • make the "always activate" solution for main profile more explicit and add comments in pom.xml about it

@lhotari
Copy link
Member Author

lhotari commented Apr 23, 2021

@eolivelli Please review. This PR revisits the modifications in pom.xml added as part of #9893.

Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch

@merlimat
Copy link
Contributor

@lhotari A couple of things are not 100% clear to me:

  1. If it's activeByDefault, shouldn't the profile be always active?
  2. If we need to activate it explicitly, that would mean that a simple mvn install won't work anymore?

@lhotari
Copy link
Member Author

lhotari commented Apr 27, 2021

@lhotari A couple of things are not 100% clear to me:

  1. If it's activeByDefault, shouldn't the profile be always active?

Maven's activeByDefault is not very intuitive. It doesn't activate a profile if there's already some other profile activate based on a rule. (one of many Stackoverflow questions about this).
Since the jdk11 profile gets activated based on the jdk version, that prevents main profile from activating.

  1. If we need to activate it explicitly, that would mean that a simple mvn install won't work anymore?

It seems that explicit activation is needed in a form or another to enable a solution for a build that has different configuration for JDK11. I've been trying to find a solution to that problem without finding a good solution. It seems that it would be possible to write a custom org.apache.maven.model.profile.ProfileSelector implementation to handle the situation. However, I'd rather find an out-of-the-box solution if that would be available.
This maven extension looks useful: https://github.com/sviperll/ozymandias/tree/master/maven-profiledep-extension . I also found https://github.com/random-maven/profile-activator-extension , which could solve the problem.

It is really annoying if mvn install stops working. I'll revisit this PR once more to fix that. However, I don't have a solution yet.

lhotari added a commit to lhotari/pulsar-contributor-toolbox that referenced this pull request Apr 27, 2021
This reverts commit f8e6ee3.

- no need for this change since the solution in
  apache/pulsar#10340 doesn't require
  "-DmainModules"
lhotari added a commit to lhotari/pulsar-contributor-toolbox that referenced this pull request Apr 27, 2021
…in profile)

- The current Pulsar build is designed in a way that "main" profile shouldn't be
  active when "core-modules" or "docker" profile is active.
  Using a core-modules profile requires explicitly disabling main profile with either
  "-main" or "!main" in the "-P" parameter.
  For example:
  "-Pcore-modules,-main" to activate core-modules
  "-Pdocker,-main" to activate the docker profile.
@lhotari lhotari force-pushed the lh-fix-core-modules-profile-on-jdk11 branch from 0a7f3d9 to 3c38624 Compare April 27, 2021 06:20
@lhotari
Copy link
Member Author

lhotari commented Apr 27, 2021

The current Pulsar build is designed in a way that main profile shouldn't be active when core-modules or docker profile is active.

I have now pushed a solution where I ended up fixing the usages of core-modules and docker profiles so that the main profile is explicitly de-activated from the command line by passing -main/!main to the list of profiles for -P on the maven command line.

For example:

  • -Pcore-modules,-main to activate core-modules
  • -Pdocker,-main to activate the docker profile.

@eolivelli @merlimat PTAL

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.

3 participants