I updated my JHipster installation as per this page by running the command
npm update -g generator-jhipster
But to update my application I am not sure where should I run the next command yo jhipster.
I tried running it from the root of existing project, but it asked me to enter the name of the new project.
I tried running it at one level above the root of existing project, then also it asked me the name of the new project. But this time I entered the same name and the jhipster generation process ran. However there was no change in any of the major files like package.json or Gruntfile.js or bower.json
What is the correct way to update a JHipster project, once the JHipster generator is updated?
JHipster developers replied over twitter saying that yo jhipster has to be executed at the project root folder.
Following [jhipster releases] (https://jhipster.github.io/2015/05/31/jhipster-release-2.14.2.html):
How to upgrade
Update your version of JHipster with:
npm update -g generator-jhipster
And then you can update your project when you run again
yo jhipster
You can also update your entities by running again the entity sub-generator, for example if your entity is named Foo
yo jhipster:entity Foo
JHipster now has a page on Upgrading an application.
https://jhipster.github.io/upgrading-an-application/
TL;DR
Running the upgrade sub-generator
Go into the application’s root directory:
cd myapplication/
To upgrade your application, type:
yo jhipster:upgrade
If you want to run the upgrade sub-generator even if no new JHipster version is available, type:
yo jhipster:upgrade --force
If you want to update all entities you need to run
yo jhipster --with-entities
from the root of your project
Our jHipster monolithic project is based on an older build of the generator, and still reliant on bower / angularjs for the client. Thus the auto-update ability would never work.
I've been manually updating spring-boot-starter-parent every other sprint to try and bring it up into 2.x parity, but am still unable to leave the 1.5.x version stream due to various dependency issues with (mainly) Hibernate.
As a possible suggestion if you're in the same boat with your own monolithic project:
Pull down select versions of the jhipster-generator
Generate a "hello world" starter monolithic project
Compare the generated pom.xml with your own project
Compare the generated entity and configuration files with your own project
Run below command at the root of your project. Also, make sure to delete nodemodules and target folders before upgrading the project.
yo jhipster:upgrade
jhipster --force --with-entities this is how i do it (npm)
Related
I have a simple Java project that creates a JAR using gradle. The project is centrally managed in a gitlab repo and built with Gitlab CI. I'm okay if every commit in a certain branch is considered "released" (ie not SNAPSHOT).
Most plugins try to do a lot and add a lot of complexity and confusion. I just need something really simple and clean. I'm okay with just using gradle.properties to manage the major and minor versions and Gitlab's CI_PIPELINE_IID as the "patch". I'm also ok with something easier than this, if possible.
Does anyone have a sample project that can easily manage versions?
I found a way to put it all together...
gradle.properties:
majorVersion=1
minorVersion=2
build.gradle
..
version "${majorVersion}.${minorVersion}.${System.env.CI_PIPELINE_IID?:'dev'}"
..
I'm using Spring Boot, so I can just do a gradle bootJar and a properly versioned JAR shows up in build/libs. If the build was outside of Gitlab CI, the JAR ends in dev instead of the CI_PIPELINE_IID value. Of course, CI_PIPELINE_IID can be set to anything on the dev machine.
I am trying to use jhipster, so far Ive seen how it works on java8, I even found an example repo with java7 that is certainly java 8 (https://github.com/jhipster/jhipster-sample-app-java7).
I was wondering if there is any way I can generate an app to run with java7? I know is deprecated from jhipster but seems like if I can run jhipster v 1.7.0 I could do it, any idea how?
So far this is what jhipster -help shows
C:\Users\user>jhipster -help
Usage: jhipster [command] [options]
Commands:
app Create a new JHipster application based on the selected options
aws Deploy the current application to Amazon Web Services
ci-cd Create pipeline scripts for popular Continuous Integration/Continuous Deployment tools
client Create a new JHipster client-side application based on the selected options
cloudfoundry Generate a `deploy/cloudfoundry` folder with a specific manifest.yml to deploy to Cloud Foundry
docker-compose Create all required Docker deployment configuration for the selected applications
entity [name] Create a new JHipster entity: JPA entity, Spring server-side components and Angular client-side components
export-jdl [jdlFile] Create a JDL file from the existing entities
heroku Deploy the current application to Heroku
import-jdl [jdlFiles...] Create entities from the JDL file passed in argument
info Display information about your current project and system
kubernetes Deploy the current application to Kubernetes
languages [languages...] Select languages from a list of available languages. The i18n files will be copied to the /webapp/i18n folder
openshift Deploy the current application to OpenShift
rancher-compose Deploy the current application to Rancher
server Create a new JHipster server-side application
service [name] Create a new Spring service bean
upgrade Upgrade the JHipster version, and upgrade the generated application
completion Print command completion script
Options:
-h, --help output usage information
-d, --debug enable debugger
-V, --version output the version number
You're referring to a 2 years old project sample. Current version of JHipster 4.x requires JDK 8, there's no way to generate a project compatible with JDK 7 with it.
The only solution would be to install an obsolete version of JHipster like 2.22.0 which is the one used to generate this JDK 7 sample project:
npm install -g generator-jhipster#2.22.0
then follow instructions of this version's documentation: http://www.jhipster.tech/documentation-archive/v2.22.0/
Having some issues when uploading my jhipster generated app to heroku, after some research I found out that some entity modifications I did while developing are not done in production db so some fields are missing.
I also added a field to User entity, so now I cannot even register/login while that field is missing from the table.
Would like to know how exacly the database generation works in prod mode so I can make it work. Could it be related to smth missing in liquibase changelog?(I'm absolutely new to liquibase so I'm a bit lost).
UPDATE:
The problem seems to be a missing column from "jhi_user" table. I need to create a database changelog to add that missing column, so I ran
"mvn liquibase:generateChangeLog"
I saw the correct changelog poping in the console, but no changelog was created under my changelogs folder. What am i doing wrong?
First, check that there is a migration file corresponding to your entity in the directory:
src/main/resources/config/liquibase/changelog/
Then confirm that the Heroku app has a Database by running:
heroku addons
Then run Maven to repackage your WAR file:
mvn install -Pprod -DskipTests
Then deploy again:
heroku deploy:jar target/*.war
JHipster will run migrations at boot time. If you are using Postgresql, you can inspect the tables by running heroku pg:psql and using commands like \d
The problem was changelogs were not beeing generated when i created entities from yo jhipster:entity command.
Solved the issue doing:
mvn liquibase:diff
Plus some hand-done changesets and adding them to master.xml.
After that:
mvn liquibase:dropAll
mvn liquibase:update
Then deployed to heroku and every table was created.
we recently migrated to Maven Build manager & git hub repository for our Java web-app. Also i switched to eclipse as eclipse has good set of plugins.
As a new bie, i am simply running mvn clean package from terminal at the code root directory. And then moving the compiled code i.e., /target/SNAPSHOT/* to tomcat/webapps/ROOT location.
And then starting Tomcat7 server. The process is time taking especially when i do code changes in Java & configuration .xml files.
I want to do it completely in IDE environment as i did earlier in Netbeans, update code -> build and run in debug mode, -> do code changes and then commit.
Heard of egit & m2e in eclipse for maven & github integration, but not sure how to use it.
Please walk me through the steps required in doing so. I am completely new to eclipse.
--
Thanks
You might want to consider using maven-jetty-plugin http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin for running the webapp. You will not need to copy over stuff to tomcat. After configuring this plugin, you can simply run your application by doing mvn jetty:run
I generally do not like running webapps inside Eclipse. It's a personal prefrence, but it is always nice to have an IDE neutral way of building and running your applications. If you have m2e things should work simply fine. I have seen maven-jetty-plugin having hot pluggability where if you changed your web.xml, jetty would reload your application.
We use Git for version control and Maven for dependency management and build automation. Once your project has successfully imported into Eclipse and recognized as a valid java web project, you don't need either Git or Maven in order to build/run it inside IDE. Just creat a server using you existing tomcat installation, add the project to server, then select Run as > Run on Server.
The Complete Guide:
Creating a server
Adding projects to a server
Starting a server
For more details, check out Testing and publishing on your server.
I have setup Spring / WTP in eclipse as well as successfully started a Tomcat 6 server within eclipse. I'm at the point where I can create a new Spring project and add source files as necessary.
Could somebody please describe (or point me to) how I can setup of some sort of 'Hello World' test and how to run it? I have experience developing in Java SE but am trying to learn Java EE / Spring.
Start with "Spring MVC Step by Step".
I know this does not answer your question directly, but you may want to consider generating a base project using Maven and then generating an Eclipse project from that.
If you decide to go down the Maven path, the process would be:
mvn archetype:generate -B -DarchetypeGroupId=org.appfuse.archetypes -DarchetypeArtifactId=appfuse-basic-spring-archetype -DarchetypeVersion=2.1.0-M1 -DgroupId=com.mycompany -DartifactId=myproject
Details: AppFuse
Once you run the above command, it will set up a complete maven project for you with a Spring MVC project stubbed out.
The next step is to simply run: mvn eclipse:eclipse to generate the project.
Details: Maven Eclipse Plugin
Once you get the code generated and the Eclipse project set up, you can read on the AppFuse Quickstart page how to run the application locally, how to debug it, and go from there.
If you're looking at using Spring in a Web-app, then perhaps this previous answer I wrote might help?
For building Spring apps, SpringSource provides a build of Eclipse 3.5 called SpringSource Tool Suite. It includes a bunch of plugins that you can download independently, but this comes with them pre-integrated. It also includes a lot of guides, documentation, wizards, and so on, which might be good to get you started.
You may find interesting the Spring Roo project which creates a Spring MVC based project directly on the IDE or via the command line.
You might want to see the ten minute video to see how it can get you up and running in no time and it also includes other features which can be not that easy to set up like security and internationalization.