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

Mvn begone #239

Merged
merged 4 commits into from
Feb 4, 2023
Merged

Mvn begone #239

merged 4 commits into from
Feb 4, 2023

Conversation

lordvlad
Copy link
Collaborator

@lordvlad lordvlad commented Feb 3, 2023

will close #220

This PR aims to add alternatives to using mvn to create the final bundled theme jar.

mvn is an additional dependency, which needs to be installed, configured, has its own dependencies, and makes building in a CI (or even windows) more cumbersome than need be.

The keycloakify section in package.json has now an additional optional option called bundler, which accepts the values ['mvn', 'keycloakify', 'none']. If nothing is set, it will default to mvn. This option can also be overriden using the environment variable KEYCLOAKIFY_BUNDLER, accepting the same values of course.

  • Choosing mvn (or defaulting) will result in an unchanged build
  • Choosing none will not create a jar. The user will need to call maven or gradle or whatever themselves.
  • Choosing keycloakify will use the new bundler code to create a jar file using nodejs libs only, no additional system libraries required.

In addition, this PR adds options to explicitely set artifactId using the keycloakify section in package.json, as well as options to override groupId and artifactId using the environment variables KEYCLOAKIFY_GROUP_ID and KEYCLOAKIFY_ARTIFACT_ID. The reasoning is, that companies often have naming conventions in place, which can now be upheld more easily.

Also added is an option to override the version from package.json using the environment variable KEYCLOAKIFY_VERSION. In our CI, for example, the version is determined from git tags and I don't want to patch package.json before running keycloakify.

Pick from 'none', 'keycloakify' or 'mvn', default to 'mvn'. 'none' will
not create a jar, 'keycloakify' will create a jar file using only tools
available to native nodejs, no additional  system library required.
Choosing 'mvn' will behave as before, starting maven in a subprocess.

The bundler can be chosen in `package.json` or via `KEYCLOAKIFY_BUNDLER`
env var.

This commit also adds `KEYCLOAKIFY_GROUP_ID` and
`KEYCLOAKIFY_ARTIFACT_ID` env vars, which will be used to
define group id and artifact id in pom.xml and pom.properties, if given.
@lordvlad
Copy link
Collaborator Author

lordvlad commented Feb 3, 2023

In a follow-up PR, I intend to make build_keycloak directory configurable

@garronej
Copy link
Collaborator

garronej commented Feb 3, 2023

Wow, nice 😻
I'm reviewing this this week end!

@garronej garronej mentioned this pull request Feb 4, 2023
@garronej garronej merged commit b38d790 into keycloakify:main Feb 4, 2023
@garronej
Copy link
Collaborator

garronej commented Feb 4, 2023

Hi @lordvlad,
Thank you very much for your work, it's realy great to drop the dependence to Maven and to have alle thoses new build options!

I documented everything: https://docs.keycloakify.dev/build-options#keycloakify.bundler

I made some little adjustmenet mostly related to type safery, you can check them out here: #240

The main thing I did is to set keycloakify to be the default bundler.
You did all this great work why not make it the default.

Again, many thanks,

Cheers

@garronej
Copy link
Collaborator

garronej commented Feb 4, 2023

Re @lordvlad,
Unless it's my mistake again, I can't build with the new "bundler": "keycloakify" option.
When I set the option in the keycloakify-advanced-starter I get this runtime error:

image

I'm on Mac M1 v16.19.0. Update, same with v18.14.0

I've put back "mvn" as the default for now...

I do not exclude it being related to my changes. I'll have to investigate, in the meantime could you tell me if the latest release works for you on keycloakify-advanced-starter, thanks a lot.

@lordvlad
Copy link
Collaborator Author

lordvlad commented Feb 5, 2023

I'll double check

@lordvlad
Copy link
Collaborator Author

lordvlad commented Feb 5, 2023

follow-up in #241

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.

Using maven to bundle the jar add superfluous dependency
2 participants