I work for a company in image processing, and one of our customers wants us to update the image viewer that goes with the product he sells. Fair enough, only he had outsourced this work earlier, and the company that did the work, has sent all its code to me. I am a newbie to Swing, and I am still learning. The project code is in the form of folders with a "pom.xml" at every level. I understand from Maven that this means that each level of the project is connected to the parent at the upper level, and is built as part of that. Now I need to break it down completely, modify and expand the code, and then build it up again. One (slow and mechanical) way is to copy each .java file into Netbeans (I use that) and then add all the dependencies, compile level by level and get it done.
Does anyone have any better ideas? Much appreciated. Thank you very much!
what you describe seems to be nothing more than a typical Maven project. Of course the directory layout may be different compared to Eclipse or NetBeans standard projects.
But I don't understand why in the world you want to break this Maven project to build it up again after you have modified the code In particular NetBeans has excellent default support for Maven without having to install any additional plugins. You can just open the existing (Maven) project in NetBeans just like any "regular" NetBeans project. One advantage is that you don't have to care for project dependencies if your Maven POM was configured correctly.
In my opinion there are many more advantages with Maven but at least it doesn't make sense to destroy a working project just to edit the code in another project layout and copy it back again. Why do you want to break the existing project? Did you have trouble running it with Maven?
Joined: Nov 20, 2009
I actually received this code from the customer, and there are a lot of dependencies in the "pom.xml" file that don't exist on my machine or network. The previous outsourcee used a repository and an ftp server and a few other such constructs which I necessarily have to replicate, and I don't understand Maven well enough to modify the pom.xml file so that I can build the existing code (with my modifications, of course) using Maven. That is why I was going the long way around. I understand that I am making a few errors in judgment, but could you enlighten me as to how I could work with a pre-existing pom file and a new environment so that I can still let Maven build and run the project? Thank you so much!
Hm my understanding of Maven is that it downloads the dependencies automatically (it creates a local repository) if you try to compile the project. Of course only if the .pom file is set up properly in the first place and knows where to get the files. Have you actually tried "mvn compile" on the command line?
Absolutely! Maven uses a concept with artifact repositories from which it can automatically download artifacts (i.e. JARs etc.). Which repositories it "knows" depends on you global Maven settings and maybe settings within the project POM.
If some artifacts are not available in any public repository you can still set up a private repository manager like Nexus where you can upload the missing dependency JARs which are in turn automatically downloaded by Maven. This has the big advantage that you have to manage project dependencies only once and every developer with any machine can automatically access this centralized dependency storage.
Give it a try and feel free to ask, if it doesn't work the Maven way
Too difficult a question for "beginning Java". Moving thread.
Joined: Nov 20, 2009
Thank you, both of you.
I followed what you suggested, the local repository idea did it. I integrated Maven into my Netbeans IDE successfully, and was able to create new pom.xml files that seem to work with my environment.
Thank you so much!