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

Remove Java constraint to install and run jhipster cli #10467

Closed
1 task done
ghost opened this issue Sep 22, 2019 · 7 comments
Closed
1 task done

Remove Java constraint to install and run jhipster cli #10467

ghost opened this issue Sep 22, 2019 · 7 comments

Comments

@ghost
Copy link

ghost commented Sep 22, 2019

Overview of the feature request
Hi all wonderful community,
The jhipster CLI required to have installed java on machine to run the generator.
My request is to remove that constraint and change the test framework question:

Besides JUnit and Jest, which testing frameworks would you like to use?

In

Which additional testing frameworks would you like to use?

Motivation for or Use Case
I have found a java check called from the general app index.js.
If there are other checks, we need to disable them because there are some blueprints (dotnet and nodejs) that not should require JAVA installed.
In my opionion those checks are not necessary, because when you run maven or gradle wrapper it logs the error and the mandatory installation.

Related issues or PR
The nodejs blueprint issue requires it.

  • Checking this box is mandatory (this is just to show you read everything)
@pascalgrimaud
Copy link
Member

Just tried it in a fresh container with only Node installed.
I got warning, not error. So these checks should not be a blocker:

root@8484b3f4ce83:/tmp/toto# jhipster
INFO! Using JHipster version installed globally
INFO! Running default command
INFO! Executing jhipster:app
INFO! Options: from-cli: true


        ██╗ ██╗   ██╗ ████████╗ ███████╗   ██████╗ ████████╗ ████████╗ ███████╗
        ██║ ██║   ██║ ╚══██╔══╝ ██╔═══██╗ ██╔════╝ ╚══██╔══╝ ██╔═════╝ ██╔═══██╗
        ██║ ████████║    ██║    ███████╔╝ ╚█████╗     ██║    ██████╗   ███████╔╝
  ██╗   ██║ ██╔═══██║    ██║    ██╔════╝   ╚═══██╗    ██║    ██╔═══╝   ██╔══██║
  ╚██████╔╝ ██║   ██║ ████████╗ ██║       ██████╔╝    ██║    ████████╗ ██║  ╚██╗
   ╚═════╝  ╚═╝   ╚═╝ ╚═══════╝ ╚═╝       ╚═════╝     ╚═╝    ╚═══════╝ ╚═╝   ╚═╝

                            https://www.jhipster.tech

Welcome to JHipster v6.3.1
Application files will be generated in folder: /tmp/toto
 _______________________________________________________________________________________________________________

  Documentation for creating an application is at https://www.jhipster.tech/creating-an-app/
  If you find JHipster useful, consider sponsoring the project at https://opencollective.com/generator-jhipster
 _______________________________________________________________________________________________________________

WARNING! Java is not found on your computer.
WARNING! git is not found on your computer.

? Which *type* of application would you like to create? (Use arrow keys)
❯ Monolithic application (recommended for simple projects) 
  Microservice application 
  Microservice gateway 
  JHipster UAA server (for microservice OAuth2 authentication)

For me, there is 2 solutions for that:

I don't see what can be done in the main generator for removing these warnings.
What is already done is the flag --skip-checks

@ghost
Copy link
Author

ghost commented Sep 23, 2019

Hi @pascalgrimaud,
thanks a lot for the help! In fact I remember that it was only a check info, but I have never tried it without java installed, and @manekinekko said that it runs an error without java.
Ok, so better, I have to remove only maven from the nodejs blueprint.
Instead, to customize the general app generator, it's not good to create a cli as Kotlin blueprint, because the developer would run the generator only with cli and not with the jhipster blueprint option. Refer this issue.
For the #9692, I have suggest here to create an option to add a yo-rc.json, in order to silent some questions and /or show only custom prompt. What do you think, @deepu105, @jdubois?

@pascalgrimaud
Copy link
Member

I'm not an expert in blueprint, and as said, it's not recommanded to create your own CLI.
But the owner of a blueprint can do what he wants and if he decided to create his own CLI, he can. Nothing is mandatory here.

About creating an option to add .yo-rc.json before, I don't know if it's doable, as it depends on Yeoman phase. See https://yeoman.io/authoring/running-context.html

    initializing - Your initialization methods (checking current project state, getting configs, etc)
    prompting - Where you prompt users for options (where you’d call this.prompt())
    configuring - Saving configurations and configure the project (creating .editorconfig files and other metadata files)
    default - If the method name doesn’t match a priority, it will be pushed to this group.
    writing - Where you write the generator specific files (routes, controllers, etc)
    conflicts - Where conflicts are handled (used internally)
    install - Where installations are run (npm, bower)
    end - Called last, cleanup, say good bye, etc

@ghost
Copy link
Author

ghost commented Sep 23, 2019

Hi @pascalgrimaud,
in my option, to keep compatibility with the other jhipster options, it's better to avoid a custom cli luncher.
The option to add yo-rc.json should add the file before calling yeoman (so before initializing phase), maybe in the app constructor.
Otherwise, do you know in what phase jhipster reads the yo-rc.json and not repeat the questions that already have answer in that file? So we can add the file before that reading. Thanks

@pascalgrimaud
Copy link
Member

If I'm not wrong, it's the phase "prompt"

@ghost
Copy link
Author

ghost commented Sep 23, 2019

Then, the function that reads the yo-rc.json is here.
And it is called in all initializing phase of every subgenerator, as here.
Therefore there are two possible options:

  • Add the --add-yo-rc option with the adding template file implementation in the general app constructor of jhipster.
  • Implement an util function (in the generator-jhipster that can be used in a blueprint) that adds the yo-rc.json provided from a blueprint project, called it for example by the server constructor class of blueprint itself.

For me it's more correct the second way, because if jhipster cli has the option, there is always the problem that the blueprint must be run with the option specifying the yo-rc template path (but because it is customizable for every blueprint it would be inside it, so not provided externally from the user runner).

So we can create an AddAllJhipsterConfigFromYoRC function in the jhipster utils

@ghost
Copy link
Author

ghost commented Sep 24, 2019

I close this issue because the solution for the app generator customization is in #10482

@ghost ghost closed this as completed Sep 24, 2019
@pascalgrimaud pascalgrimaud added this to the 6.4.0 milestone Oct 8, 2019
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant