Debugging an eclipse / maven project on a remote server? - eclipse

I use my laptop for development but its resources are limited. I have a local eclipse / maven and my local codebase and I want to keep that because I want to be able to program, compile and junit-test all time.
At my office, I'd like to be able to debug in a production-like scenario, that means, with a big database and and a 8GB RAM java heap.
I thought It shouldn't be too difficult to set up eclipse and maven to put the compiled code on a remote machine, execute a maven process (jetty:run on the remote machine) and attach eclipse for debugging. The remote machine can have its own database and I only have to make sure that the maven repositories are in sync.
Did anyone manage to run this or a similar scenario? I still could not figure out how to put the compiled sources of my ~10 projects on a remote machine. I think running a maven task and attaching a debugger should be easy with some ssh-magic.

No ssh-magic should really be required unless firewalls are a problem. Just get your project onto the remote somehow, and then run your build with mvnDebug instead of mvn. Maven will listen for a debug connection on port 8000 by default and will wait until you've connected to proceed with the build. Configure a remote debugging launcher in Eclipse, and it will connect and debug like normal. As for getting the code across, you could use rsync, but this is an excellent use case for git. That's how I do this exact thing myself.
Edit: I've never looked for a way to do this with Eclipse, but you can run any arbitrary command from Eclipse, so rsync should work fine. With rsync, you'd want something like
rsync -ruz . <user>#<host>:/<path>
Run that from your project directory, and it should copy the full content of the directory to on the remote host, only copying updated files after the initial copy. You can exclude directories, like target, with the repeatable --exclude option. E.g. --exclude=target. After copying the project, you could start a build with
ssh <user>#<host> mvnDebug <whatever>
The git way might seem a little more arcane if you aren't acquainted with git, but it has the additional benefit of being able to easily make fixes on the remote and pull them back to local. With git, you'd first log in to the remote with ssh, create a project directory, and git init it. AFter that, you can push changes to the remote at any time with
git push -f <user>#<host>:/<path> master
assuming you're working in master, and then on the remote:
git reset --hard
mvnDebug <whatever>

Related

rsync'ed outputs are always marked as outdated

Using {targets} to manage a workflow, which is great.
We don't have a proper cluster setup, but I have access to remote machines with much better specs than my laptop, so I can use git to keep the plan in sync locally and remotely.
When I want to work with something locally, I use rsync to move the files over.
rsync -avxP -e "ssh -p ..." remote:path/to/_targets .
When I query the remote cache with tar_network, I see that a bunch of my targets are "uptodate".
When I query the local cache after the rsync above, those same targets are "outdated".
I'm wondering if there is either better calls to rsync or certain arguments to tar_network(), or if this is a bug and the targets should stay as "uptodate" after an rsync like this?
OK, so I figured this out.
It was because I was being foolish about what was a target in this case. To make sure that a package dependency was being captured, I was using something that grabbed the entire DESCRIPTION of the package (packageDescription() I think). The problem with that is, is that when you install the package using remotes::install_github(), is that it adds some more information to the DESCRIPTION upon installation (packaged and built fields), and that information differed between the installation on my local machine and the installation on the remote machine.
What I really wanted was just the GithubSHA1 bit from the packageDescription(), to verify that I was using the same package at the same commit from my GitHub repo. Once I switched to using that instead of the entire DESCRIPTION, then targets had no issues with the meta information and things would stay current when rsync'ing them between machines.

From eclipse project to remote server, how can I make the process faster?

I've been developing a web app on localhost for the past few months and now I wanna keep developing it on a remote server for a more realistic environment. I have a google compute engine instance ( a remote machine with my webServer on it ) running and it takes me too much time to get my project from eclipse to my deployment server. Since I suppose this is a common use case and I'm totally new to all this I'd like some tips to speed up the process.
At the moment here are the steps I go through to get my app from localhost to the remote webServer :
In eclipse right click on project -> Export as War
git add, git commit, git push to get my project to git repository
git clone on the remote google cloud machine
Then copy the file to my destination deployment folder
This takes about 5-10 minutes to do and it seems to be a very inefficient way to do things. Especially step 2 and 3 are frustrating. While I was developing on localhost I could see the result in seconds.
How can I make the process faster ?
I would suggest using rsync on your generated web archive. I'm confused why you have to involve git in all of this, especially cloning is suspicious.
Leave your first step as is. Install rsync (on Windows you can get rsync as part of msys2 or find some other alternative).
Then you can use ssh with rsync to copy the file to the server:
rsync -e ssh app.war cloud_host:staging/dir
Make sure there is an old version of app.war in staging directory - rsync will only update differing blocks which in my practice takes less than a second for 50 MB archive. Then you can copy that archive to deployment directory of your server, if your server is deleting or moving this file from it.

Work with GIT on remote site instead of local

I have to work on a project that is on a remote GIT repository. I have a development environment accessible via ssh: I would use git on it, but I like Eclipse EGit package so I would know if there's a way to connect my Eclipse with the remote cloned repository.
Depending on the network, you might be able to mount the remote filesystem locally and use Eclipse to access the code. This will not be great on slow network.
Alternatively you can tar up the source and just copy it locally, then periodically copy to the server.
If you say that you have the development environment accessible via ssh then how will eclipse help you if it isn't in a development environment? Wouldn't you need to recreate your development environment locally as well?
You can install a remote desktop solution like NoMachine and run eclipse on the remote machine.
Please provide more details.

Use Git list output to copy files for archiving

I'm currently helping to maintain a project for a client remotely. I'm the only developer ergo some of my unorthodox approaches/thinking.
the problem
The client is using Visual Studio 2010 + Team Foundation Server for their source control. I am working on a Mac over VPN and have tried several approaches to make committing to their TFS workable. I've tried TFS plugin for Eclipse with no luck (VPN really hoses the connection to TFS). Currently I am having to do a full "checkout for edit" through a virtual machine to the TFS, then transferring the project over the VPN to overwrite those files. Not a sustainable solution to say the least.
the solution?
I'm wondering if there is a way to:
get a list of changed files from GIT (I think this is the solution
(How to list all the files in a commit?)
then use that list as a means to go in and fetch those file, maintaining their folder structure
from there I can do my dump over
VPN into the VM that has the project mapped in TFS.
Or if there is something I've overlooked or hadn't thought of, please do recommend them, I'm all ears.
First, I'm assuming you are running the VM on or near the TFS server, not on your Mac. If not, you can just share a directory using VMware/VirtualBox and edit away on your Mac...
It sounds like you could achieve what you want with plain old Git. If you:
Create a bare repository on the VM (git init --bare)
Add a post-receive hook to copy the files from the master branch (for example) into the TFS directory, overwriting merrily (http://git-scm.com/book/en/Customizing-Git-Git-Hooks)
Initialise your local copy of the source as a Git repository (git init)
Add the remote repository. Assuming it's a Windows box you can use an SMB shared folder over the VPN so your remote is "local" as far as Git is concerned. (git remote add tfsserver file:///Volumes/tfsmount/code
Your first push will be expensive (but you could prepopulate the remote repo to get around that), but subsequent pushes would be just the changesets. The post-receive hook would then take care of updating the files, and you're laughing.
Of course, you then get to impress them with how amazing Git is, get them to migrate, and your problem goes away forever :).
Update: Here's a link which describes these steps in more detail, under the guise of updating a remote website: http://toroid.org/ams/git-website-howto.

Using Git With Eclipse Remote Systems Explorer

I am doing web development using CFEclipse with Classic Eclipse (Indigo) on a Windows Server.
I am using Remote Systems Explorer to access a Linux box via sftp.
The Linux box has Git installed. There is one branch in the development folder.
I have installed EGit in Eclipse, but there are no provisions for working with a remote system.
Because I cannot develop locally, how should I checkout files, edit and review changes in a browser, and ultimately commit properly? There is no local repository and checking out files through ssh (putty) while editing them in Eclipse does not show my changes when browsed.
If you can access to the remote location through ssh why you don't just simply clone the repository in local and then pull and push the changes ?
I think that cloning the the repository is the best bet in your situation, you have only to install msysgit on your windows machine ...
You can use remote project to achieve what you need. Unfortunately, git operations need to be done on the remote server. But, you can change the files and the files will be changed remotely on fly. To create the remote project you have to right click on the remote folder you want to create the remote project. The context menu you will find "Create Remote Project".
What Eclipse will do is make the modification thru RSE. This means, eclipse will deal with save files remotely.