Intellij integrate Gradle and NPM Module - gradle

I am currently working on a project with a React frontend using Node and a Kotlin Spring Boot backend using Gradle. I want to use IntelliJ to edit those projects in the same window. So I opened the root folder as a project and added both the server and the client as modules. My file structure is roughly as follows.
/project
- /.idea
- /package.json
- /client
- /package.json
- /...
- /server
- /build.gradle.kts
- src
But if I import it like this my gradle module won't compile without errors and if I click "auto-import changes" in Intellij, it removes my npm module.
How would I go about something like this without making my client a gradle-project (which I definitely do not want!)?

Related

Customize working directory run gradle run task / project structure for web application

I'm working on small web app and I want to serve static files. I'm using application plugin. Part of it is distribution plugin which copies src/main/dist files into distribution zip. Running application with gradlew run uses project dir as working directory. For this reason static files are not found.
Is there a simple way to change working directory for run task?
Is there any other recommended structure for web app gradle project setup?
I have had a similar case when running './gradlew run' of a Kotlin (console) app. The default working directory is the application directory, but IntelliJ uses the root project directory by default.
I have managed to change the working directory by setting the workingDir property of the run task. The list of properties can be found on https://docs.gradle.org/current/dsl/org.gradle.api.tasks.Exec.html
application {
mainClass.set("myproject.HelloKt")
// Change the working directory for the run task. Here is an example:
tasks.run.get().workingDir = rootProject.projectDir
}
You need to add the following to your build.gradle file to modify the working directory of a gradle task.
File runningDir = new File('build/run/')
runningDir.mkdirs()
tasks.run.workingDir = runningDir
Check this thread for reference.

intelliJ debug not finding file in target folder

Hello I have an appengine module that won't work properly since I change my old appengine plugin to the new google cloud tools.
I have a module that is a child of my project.
I have a maven directive to copy some files from another child modules to the target folder of my module target/artifcat-name/WEB-INF.
The copy works.
But when I debug the appengine module in Intellij, I have a FileNotFoundException while trying to read the copied file from the target dir.
It worked fine before the update.
It also works fine when I run the devserver from the shell (mvn appengine:devserver.
I don't what I should change in Intellij to have it working again.
Ideas?
Thanks.

Not able to debug Jasmine Unit Tests when building using angular cli

We recently started building our application using Angular-Cli. As part of that all our configs are changed. However now, we cannot debug any of our tests directly from WebStorm. A typical directory in our project looks like
Root
-Node_Modules
-dist
-src
-tmp
-other json files.
As you may know, with angular-cli tsc will generate corresponding js files in dist folder. Our spec files are right along with corresponding ts file.
Now, I am trying to debug a test in WebStorm. it does not even execute my tests and none of my breakpoints are hit in TS file. (I can still debug in browser using js files from dist folder)

jhipster : angularjs files and browser cache

I am developping a Jhipster web app.
My problem is that when I update some angularjs files and then deploy the new war file in Tomcat7 the modifications are not taken into account, the clients pc is still reading the old angularjs file.
Is there a way(or a jhipster configuration) to tell the client pc to reload all angularjs file in order to be up to date?
Thanks you.
When you build your app with prod profile using mvn -Pprod package or gradlew -Pprod bootRepackage the web assets are minified and prefixed with a unique code in dist folder. An older version of same file has a different prefix so if it is cached it will not prevent the new one from being loaded.
If you don't see this behavior, it's probably because you didn't set the spring.profiles.active property to prod in Tomcat and so your app is running in dev mode and not using the files from dist.
If your frontend and backend are in the same war: 0.0.1-SNAPSHOT change this version in pom.xml before making a build to avoid angular caching issues.
If your frontend is split then go to: gulp/utils.js and change this version: '0.0.5-SNAPSHOT';

Jars in lib folder not picked up when deploying play application on Heroku

I have built an application based on play framework 2.0.3. I have placed some jars in lib folder (unmanaged dependencies) which are used in my application like suggested in How to put a JAR file in a Play 2 project and use it?
All is fine when I run it from my local machine with play run
But when this application is deployed to Heroku, these jars are not picked up. I get compilation errors where these jars are used.
I even tried adding dependencies.yml with below content
require:
- play 2.0.3
- provided -> myjar 1.0
repositories:
- provided:
type: local
artifact: "${application.path}/lib/[module]-[revision].jar"
contains:
- provided -> *
But still it didn't work.
My Start script (Procfile) is :
web: target/start -Dhttp.port=${PORT} ${JAVA_OPTS} -DapplyEvolutions.default=true -Ddb.default.driver=org.postgresql.Driver -Ddb.default.url=${DATABASE_URL}
Can somebody throw some light on this problem ?
Since heroku uses git, make sure that you lib folder and all contained jars are properly managed by git, ie that they are not in your .gitignore file.

Resources