Showing posts with label Subversion. Show all posts
Showing posts with label Subversion. Show all posts

Saturday, 28 November 2009

NetBeans subversion update issue

For me , NetBeans is the best IDE I tried so far…
And believe me, I tried and used plenty…
I’m not talking about Java IDE only, but IDE in general…

But there’s a bug in it that made me wonder if there is a need for me to look for another IDE to use when developing applications.

At one moment , I considered moving to Eclipse, maybe a community edition of IntelliJ IDEA, or even a JDeveloper.
After a while I decided not to switch to other IDE in the middle of the project, and I doubt I’ll be moving after because I found a solution to a problem I’ll be talking about now…
After all, this is the only serious issue i have with NetBeans so far…

So, what is it about?

I noticed that every now and then , after I update my local project from subversion repository , I have a problem deploying it…
Just for the record: project in the subversion I updated to is a fully legal and working project.

NetBeans manage to update it, but when I try to deploy a project, all I get is an exception saying:


Caused by: Action class […some Action class…] not found - action - file:/C:/Documents%20and%20Settings/Darko/My%20Documents/NetBeansProjects/MyProject/build/web/WEB-INF/classes/struts.xml:714:99
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.verifyAction(XmlConfigurationProvider.java:405)
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addAction(XmlConfigurationProvider.java:355)
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.addPackage(XmlConfigurationProvider.java:460)
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadPackages(XmlConfigurationProvider.java:265)
        at org.apache.struts2.config.StrutsXmlConfigurationProvider.loadPackages(StrutsXmlConfigurationProvider.java:111)
        at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:189)
        at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:55)
        ... 28 more



But there is no message saying what’s wrong…
As I said, this was a quite frustrating, and it still is, but now I know how to solve it and continue my work…

All you need to do is restart Netbeans and try to deploy your project again.
You’ll fail.
But now , you’ll get a message in your output window saying that some of your classes, is missing.
Find which one is “missing”.
It is not really missing. For some reason NetBeans is just saying it cannot “see” it…
Go to source packages and open this class.
Go to the end of it and just enter few new lines in it and click “save”.
Let NetBeans save it, and then do a right-click on the project and click “Build” and hit the “Clean and Build” button…


 





Now try to deploy it…
You’ll probably succed…
I know I do!

If you don’t, do all the process once again…
Not ALL the process, just the one after restarting NetBeans.

I would really like to see this bug fixed.
I don’t know if this is really a NetBeans bug, or a Subversion bug, or Tomcat bug ( I use Tomcat ) but it exists…

As I said, this is the only serious bug I found so far in NetBeans , and would really like to hear from you if there is a way of solving somehow different… Some regular way …


Tuesday, 14 October 2008

A joy of working with subversion (in NetBeans)

I didn’t know that subversion is such cool thing until I tried it…

Today, I can’t imagine a project developed without it !

I started using SVN just recently, when it became too hard for a team , that I was a member of , to synchronize itself while working on a project. Everyone had it’s version of source code  and merging all the changes was a nightmare!
That is when Me and  my team college  thought “Why wouldn’t we give subversion a try?“ After all , NetBeans ( that we use ) has integrated subversion support…

So, all we had to do was to install subversion , create a repository and start using it.
Well, not just that: we needed subversion joined with some web server because we wanted to install it on some server so everyone in the team could access it over network.

If you are in the same position and use MS Windows, I advise you to try VisualSVN server (  http://www.visualsvn.com/server/ ) .

“VisualSVN Server is a package that contains everything you need to install, configure and manage Subversion server for your team on Windows platform. It includes Subversion, Apache and a management console.”



It’s much easier than to set the apache yourself!
All you need to do is to install it ( just few easy steps ) and you’ll have preconfigured apache with subversion installed!
And not just that: you’ll even have a GUI manager to manage repositories , users and groups for it!
Cool thing!

As for now, I am very satisfied with it…

It is no longer a problem for several programmers to work on the same project at the same time,  and everyone always have  the latest version of project source code.
Even the fact that the team members are on different locations is no longer a problem…

One advice: before you start using subversion with your copy of  NetBeans, I advise you to use projects groups within NetBeans when creating/sorting  your projects.
It can significantly make things easier for you!
For example: If you are working on some large project “PR1” , I advise you to create a new folder inside “C:\Documents and Settings\...\My Documents\NetBeansProjects”  called, for example, “PR1” and to place all the projects that belong to “PR1”  inside that folder. That way, when you import some of these child projects  to SVN repository, all the other projects that are  in root of “PR1” folder will inherit the same repository path ( URL ) …
This is the way it works.
If you place all of your projects in root of “C:\Documents and Settings\...\My Documents\NetBeansProjects”, then all of them will inherit the same repository path ( URL ) and when you try to import some project into new repository - you’ll find yourself with a problem, and thing are going to become a little more complicated…

So, let’s make a few steps on how to install and use subversion in NetBeans.

First of all, go to the http://www.collab.net/downloads/netbeans/ , and download and install CollabNet subversion client. It is required that you have it installed on your computer.

Install VisualSVN .

When you install VisualSVN, start VisualSVN server manager, and create a repository, for example “PR1”.



Create new user for repository (Right click on:”users” and then click “create new user”).

You can also set who can gain access to some repository. Everyone can access every repository by default. To change that, right click on the repository -> properties-> security.

Let’s create a folder in the  “C:\Documents and Settings\...\My Documents\NetBeansProjects” with a same name as our repository.
Now, let’s start NetBeans and create a project group out of “C:\Documents and Settings\...\My Documents\NetBeansProjects\PR1” folder.






and create a project called JavaApplication1 in it…

 

Now, we have out project created, and we can now import it to the SVN repository.
Right click on the project -> Versioning -> Import into subversion repository

 

A window like this one will open:

 


Let’s enter our repository URL. You can see your repository URL in the VisualSVN server manager , when you click on it:

 


Let’s enter it .




Enter your user name and password and press next.
Give your repository folder a name. I’ll leave it the same as project folder, and enter a custom message:




When you press next you’ll get the last window, which lists all the files that you are about to import:

 

Click finish.

Voila! Now you have your project versioned!

Notice that now, when you do a right click on the project , you’ll have item “subversion” that contains actions as “diff” , “update” , “commit” and others…

Your team can now do a  “checkout…” in order to create a copy of a project on their local PC, do a “commit” when they change some part of code, do an “update” when they want to update a local project with all the changes that were made by other members of a team and so on…

Enjoy working on a project using subversion!