-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
[FEATURE] frontend-maven-plugin - A better alternative for yeoman-maven-plugin ? #3356
Comments
Oh yes, at the beginning of the project we tried it with the help of @eirslett -> we had a few issues with proxies (which should be corrected now), so we can definitely have a look at migrating to this plugin again. |
I'm testing it right now (locally and on Jenkins). I'll post my findings here. |
I'm guessing that during the
Is that correct ? |
Just did a maven release with It worked fine, but the build (a simple jHipster 0.30.0 app with 4 entities) took 17minutes. Reasons being :
I noticed in the yeoman plugin there was no npm / bower install, just the gulp build. It assumed that gulp was already installed. |
Have you tried using nvm? |
No, I didn't find
I still like the idea of being able to build an application without having lots of external dependencies (and nvm to me is still something that needs to be installed on a machine if I understand correctly) |
Yes
No
Yes with a single line. Your understanding is correct. nvm is mostly used for setting up your dev environment but I have used it successfully with Jenkins to build an Ionic app which is a more complex task than building a JHipster angular app. I'm OK with switching to another plugin as long as it does not increase build time. With Nexus 3 just being released, I plan to try it to speed up my builds and dev env setup involving npm and bower. |
@gmarziou It's an interesting discussion ... unfortunately you need to perform an There is a huge dependency tree in the jhipster package.json that takes > 6 minutes to download. The current
How long does your |
I don't like the My Jenkins build takes about 5 minutes. I read somewhere that Nexus's npm registry cache could reduce by 30% the duration of your |
IMO jhipster or the generated apps maven/gradle build should not be So there is no special handling for local build or CI build and For NPM the behaviour should be the same. If there is a local node_modules So if changing the plugin alters this behaviour then personally I do not I would happily agree with all that npm sucks :P On Thu, 7 Apr 2016 8:09 am Gaël Marziou, notifications@github.com wrote:
|
Deepu, I really think maven does clean it in prod profile, look here: |
Yes, I can confirm too, I have to comment those lines in pom every clean in prod profile in order not to delete the node_modules folder, this change can be exported to 2.27.2 too. |
@gmarziou you are right I checked on dev profile. I dont understand why its done, what is the need to delete node_modules folder for mvn clean? I dont think we should do it |
I agree, is it the same for gradle? |
Gradle doesnt do this Thanks & Regards, On Thu, Apr 7, 2016 at 2:22 PM, Gaël Marziou notifications@github.com
|
The new plugin IMHO can be fully backwards compatible with what you currently have. The only issue I have with the current setup is that it requires software (npm / node) to be available on the system and that it is not controlled by the pom.xml @deepu105 There can be argumants for and against cleaning
|
@deepu105 I'm getting the following numbers on a clean install with the yeoman plugin. Are you getting the same results ?
Keeping node_modules around speeds things up considerably.
|
@ddewaele IMO if in CI you want the node_modules to be deleted that should be task in your CI to clean up the folder before running And yes |
@ddewaele IMHO we don't have these issues with |
Also if you want you can also run `npm prune{ to remove unneeded deps from node_modules |
@deepu105 with the semver issue I'm just referring to reproducible builds. An update to gulp for example that gets pulled in via semver could in theory generate a different build. If you keep node_modules around an npm install will never update it. Someone else (a developer, or a different CI node) that starts with clean node_modules will get the updated gulp dependency and could generate a different artifact. @gmarziou : I did see this in the package.json and I'm not sure if transitive dependencies containing semvers can also alter the build, despite using fixed versions in your package.json for your level-1 dependencies.
But this is a side-track discussion and not really part of this plugin feature request. Also noticed just now that the npm install is considerably faster with the node_modules present, so don't what the issue was with my previous run (I'll update the timings). @deepu105 If we don't see a serious performance degradation by switching to frontend-maven-plugin that offers more control of node/npm and doesn't rely on external installations perhaps that ons is worth considering over the current yeoman plugin ? |
Someone made a mistake, it should be replaced by "0.4.3" as this our project rule, and it's already fixed on master: https://github.com/jhipster/generator-jhipster/blob/master/generators/client/templates/_package.json#L42 |
@gmarziou : Correct. But that still won't prevent the possibility of updated transitive dependencies (with semvers) getting pulled in I think. For that you would need to npm shrinkwrap your dev dependencies. |
Correct, but cleaning the node_modules does NOT help either. |
Correct ... Perhaps
might also be an interesting feature. (not related to this one). |
To conclude :
@gmarziou : If you guys see added value I'd be happy to create a pull request. I can also look at the Grunt file if you want (in a seperate issue). |
We do not have grunt anymore. And I definitely wouldn't want my node_modules deleted and downloaded again I dont have a problem in changing the plugin as long as the behaviour is @gmarziou I think we should remove node_modules from the pom clean task,
|
@deepu105 : we don't need to download node_modules for each build (it's already removed from the clean goal in da89a40 from @gmarziou ) Sorry about the whole I'm more interested in removing the dependencies to existing node/npm installations. |
Looks good but there is yet one thing I don't understand, I can see that it installs node and npm, runs |
@gmarziou It can do bower install, but I thought that was part of the jhipster bootstrap ? (executing bower install and checking in the bower dependencies). I assumed developers run that manually, check in their bower file + bower_components artifacts. |
Ok so I went through this in detail and here is my view
Im sorry for being difficult but hope you understand. Im thinking from the perspective of our normal majority users who might not be using a CI and who are happy with the current flow |
(1) You can configure the new plugin to behave exactly the same as the previous one. I don't think it forces you to do anything. I don't understand why you think the current one is flexible.
I would really suggest you to take a look at the 2 plugins codebases. That might give you a better idea of the quality of both plugin. The yeoman plugin source is one file so that should be quick. (2) I think this is the case. By combining gulp build and test in one shot it even runs faster with the new plugin IMHO. |
@ddewaele As I said I dont mind which plugin we use, so as said Im ok to use the new one if its better. when I said flexible I was referring to the way we use it currently in the sense it uses whatever is globally installed and locally used in node_modules. Sorry I should have used a better word than flexible. |
also I hope this plugin will use the npm proxy settings if any?? |
I think this looks like a lot of work and discussion, and:
|
Feel free to close this ... I can't keep on defending this. I did my best to explain why :) |
On my side it's only lack of time - I didn't think this would trigger so
|
I very long discussion, so I try to give my 2 cents on this. When we started a new project at work I've introduced grunt adn bower as frontend tools together with the yeoman maven plugin we are using (because I knew it from jhipster). Soon we migrated to the frontend maven plugin, for two reasons:
With the frontend maven plugin everyone is able to at least build the war file, deploy it and use the frontend. As we have put all frontend dependencies into For the gradle part, we are already using the mentioned node plugin, so adding the functionality should be no problem. |
@atomfrede thanks man. Its in line with what I wanted as well. So @ddewaele if you could amend it as per mine and Fred's suggestion Ill merge this. Sorry that its dragging. @jdubois no worries ill take care of this |
@atomfrede : About this : "As we have put all frontend dependencies into target folder doing a clean package takes quite long" This is specific to your project right and not jHipster ? |
Yes. Some are using eclipse and eclipse still can't handle Javascript and
|
@deepu105 : will finish up the PR tomorrow. Thx for all the inputs. |
I know this has been a long and tiring discussion, but some updates (just want to give as much detail as possible so we can have an objective discussion) :
So the impact on the build time will be almost non-existing. Only the very first build with The fact you can just drop this in jenkins and treat this like a pure maven project without needing to set anything up remains the strong selling point for this plugin. The plugin author also states: Not meant to replace the developer version of Node - frontend developers will still install Node on their laptops, but backend developers can run a clean build without even installing Node on their computer. Still think this is a perfect fit, even with the local node install. |
@ddewaele Great summary. From my point of view using the plugin is fine (as I said we are using it for 6 month now without big problems). Have you looked the the node gradle plugin? I think it supports the same feature set, so we should make gradle equivalent to maven regarding node handling. |
I'm not a big gradle fan/user but I'll take a look at it. Shouldn't be that hard. |
No problem, I can have a look! |
@ddewaele Thanks for your updates, you have convinced me to give it a try on my personal project. From a backend dev point of view, I think it's indeed very nice not to have to install npm globally just to to build the project. 👍 |
Im ok if others are ok with this. On Wed, 13 Apr 2016 5:10 am Florian Fauvarque, notifications@github.com
|
Fix for #3356 : yeoman-maven-plugin to frontend-maven-plugin migration
closed via #3365 |
Ping @eirslett : it took some time but we did it!!! |
Great! 😄 |
Overview of the issue
At the moment, yeoman-maven-plugin is used to handle the frontend packaging for the production profile.
Although it works it has some shortcomings :
Perhaps there are better alternatives, like frontend-maven-plugin that seems to have more features / a larger community / more stars on github.
In my current environment, I have very little control over my Jenkins installation.
This means that at the moment, I cannot release jHipster apps with the production profile, with minified JS from Jenkins.
I believe it would be better if jHipster had more control over the specific version of node/npm that is used to package the jHipster UI
Suggest a Fix
I was wondering if people were open to looking into frontend-maven-plugin as a worthy alternative for the yeoman-maven-plugin ?
I also found the CI documentation a bit confusing, as it mentioned both :
Having a self-contained maven plugin that doesn't depend on external dependencies (availability of node/npm or globally installed NodeJS modules on the system) will make jHipster more versatile.
A similar plugin exists for Gradle.
The text was updated successfully, but these errors were encountered: