Automate deployment of GWT web app - java

I am creating a GWT application in Eclipse. For the application to work, it needs to be deployed on a server that runs on my virtual machine. It uses our company's JS library, that only works in this specific environment, so I really need to compile the GWT app and deploy it to the server.
The app basically consists of following folders and files:
/war
---/images
---/resources
------/localization
------/mapdata
------/svgs
------/etc...
---/gwt-compiled-app-folder
---/index.html
I know I can have images and languages inside the GWT app but we do not want that as we may change some texts or images without the need for compilation in the future when the app will be finished.
So far my build and deploy cycle is:
Click GWT compile in Eclipse and compile the app.
In WinSCP manually copy the compiled folder of the app to the virtual machine server root.
If any other resource changes (images, localization, vector map data, json resources...) I also have to manually copy them to the virtual machine.
Since I do this like 200 times a day, I'm getting tired of it and I finally have time to improve it.
My question is how can I automate these steps? What tools should I use? I do not even know if the app can be somehow compiled from command line. Ideally I would like to run some command or file that will compile the app and deploy all the files (maybe only those that has changed or are different) to the virtual machine.
EDIT:
I finally got build by maven to work! So now I only need to know how to copy the files to the ftp.

Related

Converted jar to exe file but not working after installation

I converted my first java swing app to exe using advanced installer and inno setup(Tried both no result).
Considering Inno Setup : on double clicking nothing happens
Considering : Advanced Installer -> On executing my app open but after providing credentials nothing happens so i assume it may be database issue.
About my app: It is a small swing based saving and retrieving data of employees payment.
Database used : MySQL
I had imported database schema to client PC and made .exe file of app so that after installing it can access data.
The Jar files runs successfully and able to access the data as well.
So i think while creating .exe is their anything to be done about database .
Please suggest me where i am mistaken .
Download Launcher4J Software and build Exe out of jar file!
This is the Best and all fixes will done!
I think this is more like an application issue rather than an installer generated one. Have you tried to debug your application code after it is deployed using a setup package?
Also, in Advanced Installer, under Java Products view of your project there is a Virtual Machine section where you can choose to save the output and error stream in a log file. The log file will be created at app runtime just beside the EXE launcher. Maybe this will help you to catch some errors logged.

How to clean/publish a tomcat server in Eclipse headless mode or emulate its behavior?

I need to build a liferay portlet/project and then run the server from CLI, I use a headless eclipse run as detailed in here to clean and build my projects, but these files aren't being copied to the server's webapps's directory, they only change in the workspace, meaning my changes won't show when I run the server.
The project is fairly complicated for me, and has lots of varied files that aren't exclusively class files, so I'm not sure simply copying the .class files will do all the time, especially if there's some cached/outdated files that need removal.
In Eclipse's GUI, in the "servers" tab, clean/publish does the trick with ease, is there a way to emulate that via some assortment of commands, or via running headless Eclipse with some special parameters?

How to deploy jar both with Web Start and an installer?

I have a Java desktop application and now we distribute it as a jar in a installer of a main application (currently the Java application is only an importer/exporter). But as the jar is updated more often than the main application we are thinking of making it run through Java Web Start so it's updated independently when it start.
My question is how can I distribute it in the installer so if the user don't have internet it use the jar bundle in the installer (and copied in the main application folder) but when he launch and have internet, Java Web Start update it?
Edit: I have think in making two JNLP files one for local launch and one for online launch so it get updated, but then they need to share the cached jar so isn't installed two times, and I don't know if this is possible.
Edit, more explanations:
Maybe I haven't explain it very well. I have a native application and is distributed as an MSI, from download and through CD. With this application we distribute the Java application (a jar) that the main application used to exchange data to other formats. The MSI installs both the native app and copy the jar (not really install). Now if the user have internet and a new update is published, the complete MSI is downloaded and installed (updating the installation). Ok?
Well, we like to update only the jar in a more fashion approach, with Java Web Start, so it's updated when the jar is run independently of the main app. This have the problem that if we only deploy it as Java Web Start, if the user install the app in a computer without internet (for example carrying the MSI in a pen-drive or cd) he will not be able to use it, because as he don't have internet he can't download the jar.
And now is when my question come, can I deploy the jar in the MSI but execute through a Java Web Start so if the user have internet it get updated but if he doesn't have internet it still can use the bundle jar in the MSI?
..can I deploy the jar in the MSI but execute through a Java Web Start so if the user have internet it get updated but if he doesn't have internet it still can use the bundle jar in the MSI?
OK, I am formulating a plan here, this might be doable.
Let us presume that the MSI is capable of doing the following things.
Install a JRE if missing or too low a version available. The JRE needs to be included in the MSI (to avoid requiring the net).
Unpack the JWS launch file and Jar(s) (and native..) to the local file system as temporary files.
Invoke the javaws tool using 'IMPORT-OPTIONS' to set the code-base to the place in the local file-system they were unpacked.
At this point, desktop icons and shortcuts should be installed, and the program ready to launch. It is vital to specify a few extra options in the JNLP - specifically offline-allowed to ensure the app. can still be launched if the internet is not available.
Caveats: I don't have any experience with MSI, and my experience with using the import options is limited to calling them from build files (during development).

Trying to remotely compile, using the command line, a Java program with multiple dependencies that I can currently only compile locally in Eclipse

Some weeks ago at work I took over a Java-based back-end web application written using Eclipse. The nature of the application is that it cannot be adequately tested locally, and instead changes need to be tested on our testing network (which involves pushing the changes to an AWS Micro server that we connect to via SSH).
Until now, I pushed changes in the same way as my predecessor: compile the program using Eclipse's Export to Runnable JAR File option, then scp the jar to the remote server and run it. However, this process has a huge problem. While compilation takes only seconds, the jar is well over 30MB, and pushing the entire thing from the office to the remote server over our fairly ordinary internet connection takes well over 10 minutes. If I'm having a particularly bad day and, say, introduce several minor bugs to the code and then discover them one by one, I can easily end up losing an hour or more in total twiddling my thumbs while pushing the whole jar over and over for a series of one-line changes.
Clearly, a saner solution than scping the entire jar for every change would be to simply remotely pull only the changed .java files from source control, and then compile the new version entirely remotely. However, I'm quite new to Java (and indeed programming generally) and all my Java work has been on existing Eclipse projects that I've taken over partway through development. As such, I know very little about compiling Java, and I have found the tutorials about this online are mostly either opaque or completely fail to address the question of how to compile code that uses external libraries.
I will relate here what information about the project's dependencies I can find from Eclipse, and my questions are these: what do I need to copy to the remote server, and where do I need to put it, to be able to compile remotely? What tools, if any, do I need to install on the remote server to be able to compile there? And once I've got everything set up, what do I actually type at the command line to get it to compile?
Anyway, here's what I know about the dependencies and directory structure (I've anonymised our application name by calling it “bunnies”):
The application source code is located in bunnies/src
We compile to bunnies/bin/main.jar
bunnies/dependencies contains three jars of external libraries that we use.
Right-clicking on the project in Eclipse, going to the Java Build Path section, and selecting the Libraries tab, I see
the three libraries above
(appearing in the form, e.g. “json-simple-1.1.1.jar - /home/mark/workspace/bunnies/dependencies”)
a fourth jar file in another location
(“M2_REPO/com/google/guava/guava/r09/guava-r09.jar - /home/mark/.m2/repository/com/google/guava/guava/r09/guava-r09.jar”)
JRE System Library [java-6-openjdk-i386]
But there's more! We also use two libraries, mahout-core and mahout-integration, that are included as separate projects in the same workspace rather than as jar files in the dependencies folder. They appear by name on the Projects tab of the Java Build Path section of the bunnies project, and are located at /home/mark/workspace/mahout-core and /home/mark/workspace/mahout-integration respectively.
Since I am not a Java whiz, perhaps there are also some other hidden dependencies I'm missing, that don't appear in any of the places I've looked so far?
If anyone can walk me through the steps of compiling this huge mess from the command line, without needing to use the Export option in Eclipse, so that I can ultimately compile it all remotely, I would be highly appreciative.
Look into Apache Ant. It's a build-suite for Java, sort of like an XML based Makefile system.
I have a Java system running on a remote server. I have a directory structure separated into /src and /build. I then just scp the .java files from my local machine to the /src folder and build using ant.

Deploying java applications to Tomcat using CruiseControl.net

I have CruiseControl.net setup on a machine which is currenly being used for Microsoft Projects.
I needed to add a java project to the same build server.
The java war files generated need to be copied to another server under Tomcat.
However, I face a lot of problems when it tries to copy to that network location, due to file access denied messages, as certain jar files are being used.
I tried to remotely stop tomcat before attempting to copy the files but wasnt successful doing that.
There are Ant tasks that allow you to admin Tomcat using build.xml. Maybe those can help.

Categories

Resources