Generate .war file from web app - war

How can I generate .war file from web app containing just HTML, CSS & JavaScript?
Is there any way to do that using webstorm?

I think IntelliJ has a way of doing it but Webstorm doesn't.
http://www.jetbrains.com/idea/webhelp/configuring-web-application-deployment.html
However if you have Java SDK installed and environment variables set for it you can create .war files from the command line. Just navigate to your project area and use the command
jar -cvf myApplication.war myApplicationFolderName
Hope this helps

Maybe you can configure a grunt file and make a war task
https://www.npmjs.com/package/grunt-war
the good thing about this is that you will be independent from the IDE or editor you're using.
In practical terms, it worked for me

Related

Im building .jar of my program in InteliJ, but I added external .jar with JTatto LookAndFeel and the app doesn't work from desktop. How to repair it?

It's simple application. I'm pretty sure it doesn't work now from Desktop, because of external .jar added at the IDE.
Ok, basically just go in project settings, dependencies, add your jar (dont export) and then build normally
I had to create new project to make it work

Is there a way to minify css files at build time?

I'm dealing with an ASP.net project that's maintained by a couple of people via git.
We're looking to minify the CSS files at build time and have checked out the bundle and minify addon however this doesn't appear to offer an option for the minified code to be regenerated from the source files at each build.
Is there a better way for us to minify our source css files on each build?
Understanding your question right, you want to concat and minify your css sources and time you build or deploy.
I do not now how your build stack look like, so I can guess only, but using css files I would use something like grunt or gulp.
On my self I prefer gulp. It is easy to create a task which concat, minify or also auto prefix your css files.
Once your task is created you can add it to your build script, task or bash.
This way works also fine with CI like wercker or travis.
You can use Microsoft Ajax Minifier after build.
Explained here: https://www.codeproject.com/Articles/182690/Minify-Javascript-and-CSS-using-Microsoft-Ajax-Min
Or if you have integration with Jenkins then after build step you can call bat file and run minification on folder of your build directory.
For multiple technology projects, You can create exe based on Microsoft Ajax Minifier and after all builds are done, Run this exe using bat command from Jenking only to minify all the css and js files.
I have integrated this with PHP, ASP.Net and Silverlight code after build of these projects.
One better way is to make your file to online file (like CDN link github can help you in that) and next rather then adding all those css add that link which will be saving much of the build time.
Try to minify your file.
Try to make an online link file.

Sass (LibSass) with Spring MVC and JAVA

I was planning to use Sass with my Spring-MVC application. From Sass-lang website I got this Maven LibSass Plugin. I have put it in my pom.xml
But I am really confused with what next?
The major doubts I have are:
Which directory I should keep my Sass files in?
How do I include them in my HTML files?
What should be the target dir?
As of now, if I keep directories as suggested by my plug-in, it crashes either eclipse or stalls maven clean and install goal execution. I very new to this concept. Do let me know if you need any other info.
Actually these are all up to you.
You can choose an arbitrary directory. Most probably you would not want to serve Sass files. Thus this directory should not be deployed. libsass examples use src/main/sass directory.
You should include the .css files created at the target directory manually. libsass does not handle this part. There is no automatic inclusion of the compiled .css files as in Ruby on Rails platform.
Target directory is arbitrary again. Remember the choice of directory depends on how you will refer to these files at views. For example if you will be manually referring them, most probably you'll want to specify a target directory that is actually deployed to application server, such as src/main/resources/css.

Being able to run java application on different computers without JDK

How can I send my java application to a friend without having to send the entire project and being dependent on him having JDK? I'm aware of the .jar-file's existence, but I don't know how to proceed. I would like to be able to just send him the .jar-file or an executable file.
Any ideas?
Compile it to native code using a compiler such as http://en.wikipedia.org/wiki/GNU_Compiler_for_Java
Also, he doesn't need the JDK, just the JRE.
Did what #Barranka said regarding the dist folder, didn't know that worked until I read the readme file as #Barranka suggested.
So to quote what #Barranka said:
If you work with NetBeans, when you "build" your project, a dist
folder is generated, and your "packed" app is stored there. You can
send the contents of this folder. Read the "readme" file in that
folder. – Barranka
You can send the JAR file alone provided your program does not depend on other libraries. Assuming that there is a main() method and Main Class is configured in the JAR's manifest, the person can run it by Double Clicking (on windows) or use the command line
java -jar <jar_file_name>.jar
You cannot execute a Java application without a Java Virtual Machine, so you need one.
Your friend has to download a JRE/JDK, or you can provide it with your application directly as it (the JRE and your project in an archive) or provide it as a native compile code using GCJ or Excelsior Jet which will compile your application and a JRE.
As you can see the is no solution for your question, but there is one for your problem : ask your friend to download a JRE.

How do you enforce dependencies among java folders in Netbeans?

I am new to Netbeans. I am wondering if someone can help me with project setup in netbeans. I am moving half million lines of Java code from a different IDE to Netbeans. I was able to get the code build and run in Netbeans easily. I have a project with many folders with dependencies among those folders. They have to be built in specific order. This is to enforce layering so that a module in lower layer cannot call into higher layers. I couldn't get that configured in Netbeans. Below is how my project looks like
project/
libA/
libB/
libC/
libD/
libE/
appA/
...
I have one project that builds all the libs and appA. The project build xml is stored under project/ folder. But the libs have dependencies among them. libB should be built after libA. libC after libA. libE depends on libD and libB etc.
I tried to change the order of source folders for libs in project properties. That didn't seem to make any difference. Even if I move libA after libB, it was building everything fine. I expected it to fail because libA didn't build yet.
Iam lost. Just wondering what the trick is to enforce this kind of dependencies. I created my project using "Java project using existing sources" wizard.
I appreciate your help
Thanks
Video guy.
Even though it would be a pain, you could just write your own ant build script and then just have Netbeans use that.
Basically:
write the custom ant build file
install the Ant plugin
create an Ant build file
right click the build file
run the selected target.
This would enable you to enforce whatever you need to do, but, if Netbeans is figuring out the correct order then why not just use it.
Does something break when you just compile and run in Netbeans?
Well! Lets say a team member added piece of code in lower level package that calls into higher layer code. It should fail because it breaks the layering. Because Netbeans seem to compile all the files in one javac invocation, the build compiles just fine. I want Netbeans to break the build in this case.
Writing my own ant script is another way of enforcing it. The whole point in using an IDE is to save yourself from writing your own make files (or ant scripts). This is something any IDE was able to accomplish 10 years back out of the box. I am wondering if I am missing something here.
Thanks
Video Guy

Resources