Same NetBeans Project from Two Locations - java

I have a desktop at work, and a laptop at home. I do not carry my laptop to work. Is there an accepted way to use the same NetBeans Java project from both machines?
I currently store the project in a Dropbox folder and access it from both machines. It works 95% of the time, but I occasionally have little glitches (library references, filename case-sensitivity, etc).
I have used a shared network drive, but the latency when compiling and deploying from home isn't acceptable.
I guess I could commit it to SVN everyday, but I probably won't always remember.
Looking to know how others might approach this.

Source control is the best option here, You could use some free SVN/GIT service provider too for your private project
See
https://stackoverflow.com/questions/59791/free-online-private-svn-repositories

Create a bare git repository in your dropbox folder and push/pull from that at home and work. It works very well, and its not that hard to remember. The nice thing about git is that you only need shared disk, which dropbox takes care for you. You don't need a server.

I'm part of a project java and we use a netbeans plugin named Team Server. This plugin allow you to create a project in java.net and work it under Kenai infrastructure. It is really easy to use.

Related

Local development setup

I'm currently looking into what better ways there are for deploying/setting up webapps locally after code changes and database changes.
So far I've seen the following tools/ways come by, and attempted each of them:
ANT build target that compiles, makes a jar, a war file and deploys that to the tomcat folder
Gradle build in combination with the tomcat plugin, which already does a bit of a better job than option #1
Good ol' fashioned command line
Setup run configuration within Intellij to do the deployment for you
Write shell script and call this via command line (haven't tried this)
To be honest I'm not finding each of these the ideal solution. I find option #4 the easiest as it allows me to, via a short-cut, easily deploy my changes and continue. This has however not given me an option for database changes yet, probably just me that missed it.
My question is mainly what tools/ways are you guys using in order to achieve an easy and maintainable development environment? What considerations come with those?
Well, let me tell you what I do for local web app setup.
In your favorite IDE(eclipse in my case) i'll configure the application server plugin(tomcat or webpshere) from Eclipse marketplace.
This setup will help to auto publish code changes to the server whenever I make a change in the application. I use Maven build tool for the application packaging. However I'm not sure about the database side.
For the people that were wondering how I ended up doing and found the best to work for me.
I currently have configured my IntelliJ IDE in such a way that the tomcat instance is linked and can be properly controlled and deployed, including debug, from within IntelliJ itself. This allows me to, via an easy shortcut, instantly populate any resources changes (css, javascript, front end) or redeploy or even restart the server. Especially with a small application this works very well.
It is yet to be determined whether this would still work with a multi-module setup and a larger project size.
Should you want more information on how this configuration can be achieved, feel free to send me a direct message.

How to Group Programming cross Internet

Alright, me and a few others are looking to work on a project together, and we have our own VPS to host the server as it runs, but the problem is that we need to be able to access the source at the same time to edit things; now I'm wondering if there's some sort of way to set it up via FTP or something, and if so, what if we were to unknowingly access and save the same file, it would cause loss of data.
How can a few people and I access a source project hosted on a server at once without loss of data? To clarify, we're using Netbeans as our IDE, and it is a Java project, JDK 8, contains anything from text files, to image files, to java source files, so it can't restrict file types.
The universal way to work on a codebase as a group is through a version control system. Version control systems allow for the merging of code to prevent data loss and give you full line-by-line history of your project. Git is probably the defacto at this point in time, and loads of sites will let you host Git repositories for free.
GitHub is one of the most widely used Git repository hosts. They offer free hosting for open-source ("public") repositories.
BitBucket is another monster, and they offer free hosting for both open and closed source repositories.
You can find many others with a simple web search. GitLab supposedly allows you to setup a simple local repository which may be what you're looking for.
You can refer to the Using Git Support in NetBeans article to get started.

How to share work space in eclipse?

I have following problem:
3 people are working on the same Java project and want to share a workspace so we can all work together. Our computers are connected to a local network, but we want to share the workspace created in one computer.
Git is currently the standard tool to use in this case. There are others but I would recommend using it over anything else. It is also free.
http://git-scm.com/
After downloading and installing on each of your machines create a public repository to store the project.
Here is the getting started page:
http://git-scm.com/book/en/v2/Getting-Started-About-Version-Control
Multiple Eclipse instances would NOT run well on the same "physical" files. Eclipse does not even reload directories when there are modifications. This means, you get trouble if you sync the filesystems.
The best way to work together and share the code is to use some kind of revision control system, i.e:
git
SVN
Mercurial
I would look into setting up some kind of version control, like Git, and some hosting service.

Compile Source on Network Drive onto Local Drive

I want to avoid using a service such as Dropbox to store code, even though it is convenient. I'd prefer to store my source on a shared network drive for security reasons, and then access it from two different places.
However, when I do this using an IDE such as Netbeans, the network latency is pretty bad, even when I am on-site, not at home.
Is there a way to store source code on a network drive, but have the compiled objects (classes and war files) written to a local drive? That way I could deploy the local war without having to write it back to a project on a network drive
From what you are describing, sounds like you really should be using Source Control of some sort instead of just sharing over the network. Using source control will really make it simpler when you have multiple boxes editing the same code. Seems like the you already have network access between the boxes, so you would just need to setup your favorite Source Control repository that is supported by NetBeans, such as git or subversion.
Setting up a repo can be a pain, so a web service is always an option. I believe Bitbucket from Atlassian allows free private repositories. There is also Github, but only public repos are free. If you need Subversion, there is Beanstalk, but you have to pay for the service. These are the ones I am familar with, there are a bunch more Source Control services out there.
Under Linux, it is possible to mount a shared network folder anywhere in the filesystem. You can mount it as source folder and have all source files there, and keep all other folders local. Your NAS box most likely supports NFS.
If you do not want to move the current mount point or if the source folder is not at its root, it is also possible to create a symbolic link to it (ln -s target_folder link_folder). It behaves like a pointer.

How can I back-up my java project in Eclipse?

I'm new to development and I'm sure this is a silly question but i can't work out how i should be backing-up copies of my project.
When everything's working right i want to save a copy/make a back-up so that if i ever mess everything up i'll have something i can go back to, but of course it's not as simple as just copying a file like i normally would for anything else. Sorry for the silly query, but if someone could point me in the right direction as to how i should go about this that would be great!
It's not a silly question. You can back up your project directory (just make a copy, zip, etc) but I would advise you to have a look at version management (cvs, subversion, git, whatever you like). With version management you can go back to any state, create different development branches etc...
When everything's working right i want
to save a copy/make a back-up so that
if i ever mess everything up i'll have
something i can go back to
A version control system is perfect for you. Eclipse allows to clone your repository into a version control system such as CVS, SVN, Mercurial, Clearcase, Git, etc.
For me, I use Mercurial (previously using SVN), and its Eclipse plugin can be found on JavaForge.
I find Mercurial to be very handy.
It requires no server, but it still allows for multiple developers on the same project by splitting the program into two different branches of development and merging them together when complete.
Even without resorting to a version management, Eclipse provides a similar feature:
in the Preferences, go to General -> Workspace -> Local History
You can export your project as an archive and just save it somewhere, then import it whenever you need/want to. Just right click on the project, choose export and follow the instructions
Version control software is usually the best option, allowing you to create branches and browse revisions easily.
If you're on Windows, you can set up a local SVN repository using VisualSVN server very quickly.
If you'd want the repository online, have a look at Google Code (only open-source) or Assembla (they mostly offer paid services, but do provide nice and free SVN or GIT repositories).

Categories

Resources