Spring Boot IntelliJ Make Project not working for static files - angularjs

I have a Spring Boot (1.3.5.RELEASE) project in IntelliJ 15.
My web application is AngularJS based. If I edit a html file in the src/resources/static folder and press CTRL+F9 (Make Project) the updates are not synchroizied to the target folder of the project. Why is intellJ deleting the files during "make project"?
What is an easy way to sync the src/static folder with the target dir?

Related

Netbeans JSF - Creating executable JAR file

I'm working at the moment on an JSF Project project. Everything is working fine. Creating .war-file, deploying it.
What I actually want is, to create a executable JAR-file for a single Class. In this Class I have a Main-method that sends an email after executing it.
I the past I have worked with Eclipse. And that was very easy.
Now I am working with Netbeans. I have red a lot of posts with the information to clean and build the project. Next to that checking the .dist folder for the JAR-files.
I have either the .dist folder, or any JAR-files in my Project folder for that correlate file.
How can I easily create that JAR-file in Netbeans?
Assuming you are using a native NetBeans project rather than Maven:
The build artefact of a project is defined by it's project type. A JSB/Web project is always build into a WAR file.
If there is one class in your project that you want to put into a JAR file, the clean solution would be to create a new "Java" project with that class (as your class clearly has no dependencies to your Web Application this should work).
For such a project NetBeans will automatically create a runnable JAR file if you configure the main method.
In your JSF project you can simply include that project as a library. If you enable "Build projects on classpath", the jar will automatically be build when you build the web application.
Another approach would be to customize the Ant script NetBeans uses internally and add a target that builds your executable JAR file from that single class.
Details on how to customize the IDE generated Ant script can be found in the manual:
https://docs.oracle.com/netbeans/nb82/netbeans/NBDAG/create_japps.htm#CHDDAHEB

easing the gradle build process in deploying spring boot and angular js application

I am working on gradle based spring boot and angularjs project. I have all my angularjs code in static folder which is committed to Git. We need to deploy it into a server which does not have access to internet. So I have generated dist contents using gulp serve:dist and replaced the contents in the static folder with the contents of dist folder. Then I have generated jar file and deployed in server.
So it is becoming manually cumbersome every time to replace the contents of static folder with the contents of dist generating jar file then removing the dist folder contents from static folder and then replacing it with original angular js code.
Is there any possibility to generate the jar file directly using the contents from dist folder instead using the contents in static folder?
I am not sure whether I made the problem clear or not. Please update me if you need any further clarification.
If you are using Spring Boot with standalone JAR deployment, you just need to output front-end assets into src/main/resources/static and Spring Boot will serve them via embedded container.
You can use Gradle Gulp Plugin to execute Gulp build as task within main Gradle build.
Reaction on comment:
Mentioned static folder of course contains only assets you intend to serve by Spring Boot. It wouldn't contain code or anything else. You can have your code in e.g. [projectRoot]/jsSrc. Just Gulp needs to know where to find these files.
We are using such directory structure without any problems (with CI build running on every commit). If manual action is needed to build project, your build is fundamentally broken. In this case your issue is misplaced JS source files.

Angular js with spring mvc

Currently trying to implement angular js with spring mvc
Tried to implement the sample project springmvc-angularjs-master from the site-https://github.com/xvitcoder/spring-mvc-angularjs , not sure how to use the folder structure of this sample project into a spring project.
i read the thread - Spring MVC and Angularjs
but still could not find the solution. Do i need to create new folder webapp under the src folder in the web application?
can someone help me how to convert this sample project into spring web application?
i am not using maven and using simple web application with spring capabilites in myeclipse ide.
Current project folder structure:
SampleApp
-src
--controller,bean folders
-webroot
--webinf
---web.xml,springmvc.xml
---html folder(index.html,etc.,)
--resources
---js
----app.js,services.js,controller.js and lib folder
You should be able to import the project as Maven project (Import > Maven > Existing MavenProject) and run it as is. All of the necessary mappings can be found in /src/main/webapp/WEB-INF/spring/webapp-config.xml
Once you have your head wrapped around that, you should be able to extract what you need.
I also noticed some of the #override annotations were throwing some errors. I just removed them.

refresh workspace or upload file to a tomcat server? How to

I have a dynamic web project (JSP) on Eclipse that runs on a tomcat server. I create files with GraphViz code, and then I create images with a system call of DOT and I place them in a subdirectory of the project.
All of that works, but now the issue is to show the created images in a JSP page.
As the images are dynamically created they are not in the server neither in the project subdirectory until I manually refresh the project at the workspace.
To solve this problem that I have tried to use the aspectj libraries that contains the IWorkspace, IProject, IFile classes, but it seems that that usefull only if you are developing an Eclipse plugin.
I am thinking about another way to refresh the workspace dinamically or upload the images to the tomcat server.
So the questions are:
how to upload files (images) to a tomcat server with Java (JSP)?
how to refresh the workspace dinamically in a non Eclipse (or Eclipse plugin) project?
how to show images in a JSP page that are not in the project workspace neither in the tomcat server?
Take a look at Tomcat plugin for Eclipse. It probably should help you to solve the root of problems.

How to change the file upload folder in apache tomcat?

Tomcat 6.29 creates a folder under temp folder in apache tomcat, and when I uploaded a file with the path req.getSession().getServletContext() + specified folder but when the application is redeployed another application folder is again created so the previously uploaded files stay at the older deployed application. I want to upload files under webapp folder/app_name but at that time I take the specified doesn't exist. I wonder if it is possible to upload and retrieve the files under the webapp/app_name.
Note: application is developed with spring+hibernate and deployed with maven.
Yes. Just use a relative path in your file handler code. Go up with ../../.. etc. Or you can make a direct server request against the old app from within your handler - servlet to servlet, for example.

Resources