Jhipster with production profile - java

I have built my jhipster application in production version(frontend app), it did minify all the javascript files and html files, I can see that inside the war, and I run the application in production version too as after completely starting it says jhipster started and the profile has swagger, prod. But when I access my application there is little source folder that gets created and that exposes all of my javascript code as javascript is not minified, over there.
what is this folder?
Why does this folder exists?
how do I disable this folder?
Link to the screenshot

You should probably disable source maps in gulp/build.js also gulp-uglify uses default options which you may want to change.

Related

Gradle exclude property value or file from gradle during build except locally

So i am not really sure how to ask this question so I am going to try my best.
I currently have a file within my project that is used for SSO oidc configuration. For the most part we do not use it, most of the configuration comes from the dev database. The only value that we do use is the callback url, Which calls back to localhost instead of the dev environment. When my application starts up i check to see if that file exists and pretty much override dev configurations with anything in that file. Mostly so we can just return back to localhost. I also do development work and need to add or change additional values locally so the ability to override is needed for me specifically. So the issue i am trying to find a solution for is when we jar the application that oidc configuration file also gets included and deployed to the server. This then will make the dev environment point to localhost. I tried excluding that oidc configuration file from gradle but then when i run the application locally it also excludes it and then does not have the file locally. I am trying to figure out a way to only exclude that oidc file configuration when deployed to dev/test/prod but keep it locally. Or maybe even a different approach would work too.
For this case, you can create a local directory in your resources folder, then in gradle you can exclude this directory specifically to be bundled when jar is created using below:
jar {
exclude ("DIRECTORY-TO-EXCLUDE/**")
}

What generated my "appengine-web.xml" file?

I inherited a Java app that is configured to run in Google App Engine. My pom includes the com.google.appengine.appengine-maven-plugin plugin, which may or may not be related to this question.
In my src directory, in the WEB-INF directory, I have a "app.yaml" file. But when my project is built into a war, the target directory has both a "app.yaml" file and a "appengine-web.xml" file. How did this "appengine-web.xml" file get here?
The first line of this "appengine-web.xml" file says <!-- Generated from app.yaml. Do not edit. -->. If this file was generated from an "app.yaml" file, then what generated it? Which plugin/function has created this file?
As mentioned in the official documentation appengine-web.xml Reference:
App Engine Java applications use a configuration file, named appengine-web.xml, to specify information about your app and to identify which files in the app's WAR file are static files (like images) and which are resource files used by the application.
So, this is created by default, by the App Engine environment, when using the App Engine Maven plugin, so you can handle some specific settings and configurations. You can find more details on these settings here, but it includes the setting of environment variables, how to scale the application - manual, basic or automatic - etc. In addition to that, you can check this example of a sample app that is deployed into war and the file is created as well. Please, bear in mind that this is only on Java 8.
To summarize, this file is created by the App Engine environment when using this plugin, not by a specific function. In this official documentation here, it indicates this as well:
The artifact you used to create the project has done the basic src/main/webapp/WEB-INF/appengine-web.xml configuration for you
So, this confirms that it was created via the plugin. Besides that, it shows the message of the relation with app.yaml, because they work together and each one of them has a specific use and settings that are needed for your application to work correctly.
Let me know if the information helped you!
This was a non-documented feature of App Engine Maven Plugin that was removed about two years ago.
https://github.com/GoogleCloudPlatform/app-maven-plugin/issues/426#issuecomment-665757462

Avoid refreshing html pages in eclipse for spring boot app

I'm using Spring Boot to deploy a webbased app (services on the backend, SPA app for the front end).
I'm not using Eclipse to edit my html-related files.
If I put those files under "resources", when using Eclipse to debug the app, any changes (to the html-related files) made using the other editor is not picked up by the "embedded" tomcat, unless I refresh the file in Eclipse too.
Everything works great if I put the html-related files in webapp/: I don't have to refresh the files in Eclipse; but then the files are not picked up by the jar maven build (because spring boot jar is not supposed to pick them by design...)
How do you usually work with html-resources?
I don't want to use Eclipse to edit my html-related files, and I don't want to use nodejs/other proxy-style server tool (I have a capable webserver called "tomcat", I don't see the need to have yet another tool to install/configure/update etc)

Servlets and Apache Tomcat Server

Can anyone tell me..while running servlets iam using apache tomcat. But everytime i make changes to my web application..I have to export the war file and put into the webapp directory again and again..it is too much time consuming and very hectic. For even small changes i have to export war file and then put in my webapp directory. I cant run my web application without doing this..i mean new changes are not reflected till then..
Isn't there any other method..i think auto deploy should do..and however it is set to true in my web application. but it is not doing it..I have been searching on the net since 2 days..but didn't got any solution..please help..
A WAR file is basically just a .zip with the respective webapp contents. Instead of deploying a WAR, you can deploy an "exploded WAR", being the contents of your webapp. Various build tools support doing this, for example, Maven supports the dir packaging in the assembly plugin. Then, you can for example configure your project to build classes directly to your WEB-INF/classes directory of your "exploded WAR".
EDIT: In case it wasn't clear - you just put the exploded WAR within a directory in the webapps directory where you normally put the WARs - so instead of application.war, you just put an application directory containing the webapp.
Most popular IDEs like Eclipse, IntelliJ or Netbeans provide web testing and publishing tools for users, it's a very basic feature.
In case you're using Eclipse, navigating to Web Tools Platform User Guide > Using the server tools in help page, should be sufficient for you to set up the environment.
Here's online help document for Eclipse Mars, for your convenience.
IDE
You can develop with IDEs like Eclipse or Netbeans. It will be easy to develop and auto-deploy will be taken care by themselves. It will save much time. And completely developed final product can be exported at final stage.
As mentioned, the IDEs nowadays can do some rapid redeployment or hot-swapping of classes. This can work for some scenarios but not all.
JRebel
For even more advanced hot-swapping in more scenarios, consider the commercial tool JRebel by ZeroTurnAround.com.

Java Web Start and Folders

We currently have an Java application that can be deployed on clients or run as a shortcut from the server. We have intermittently received ClassNotFound exceptions when running the JAR from the server which looks like Windows dropping the network connection with only part of the classes from the JAR loaded (user opens a different screen then the problem is apparent).
I am currently looking at the Web Start technology to allow us to run a single shortcut.
However the application has several folders it requires to be in the same folder the JAR is launched (for configuration, logs, etc.). These folders will require full access for all users to allow them to write log files. There are lots of configuration files under the configuration folder hierarchy.
The application also requires access to environment user settings (such as getting their user folder). It also requires certain command line parameters (including which folder to use for configuration, log file location, java memory usage, etc.)
Edit
The application also contains a reference to 2 signed JARs. These are:
jh.jar
mail.jar
It looks like these are signed by SUN Microsystems. jh is used for help integration in our application whilst mail is used for email integration.
I have now downloaded the latest versions of these files from java2s.com which do not have the signed equivalents.
end edit
The application is developed in Netbeans which compiles a single JAR file and copies the dependant JARs to the dist/lib folder. I enabled the Web Start functionality in Netbeans for the application and it generates the JNLP file.
Bearing everything in mind is Web Start the way to go for an application like this?
Can you include folders in a Web Start deployment? I could not find anything to do this in the XML structure for a JNLP file.
Cheers,
Andez
Yes, you could use WebStart for this.
Permission:
If you need permission to the file system, you have to sign your jars and put the all-permissions tag in your jnlp.
Arguments:
Arguments can be provided by using the arguments elements in application_desc.
Folders:
I'm don't think you can include folders in the WebStart application, but you could put the config files in a jar and read them from there, or extract them on startup.
ClassNotFoundError:
We have intermittently received
ClassNotFound exceptions when running
the JAR from the server which looks
like Windows dropping the network
connection with only part of the
classes from the JAR loaded
Does not sound plausible to me. per default, all jars will be downloaded before the application starts. If you set "download" to "lazy", the jar will be downloaded when first needed, but I would guess it will be downloaded completly then.
You can provide read-only resources for Java WebStart. Getting the log back is harder. I would suggest looking into a centralized logging solution, using one of the standard appenders in the log framework you use.
For a Java Web Start application it is always advised not to create files or folders in the class path. Recommend user's home directory to store your settings or database files.

Categories

Resources