aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes I have a few questions about Maven Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "I have a few questions about Maven" Watch "I have a few questions about Maven" New topic
Author

I have a few questions about Maven

harish kshatrea
Greenhorn

Joined: Nov 20, 2009
Posts: 14
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!

harry.
Marco Ehrentreich
best scout
Bartender

Joined: Mar 07, 2007
Posts: 1280

Hi Harry,

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?

Marco
harish kshatrea
Greenhorn

Joined: Nov 20, 2009
Posts: 14
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!

Sincerely,
Harry.
D. Ogranos
Ranch Hand

Joined: Feb 02, 2009
Posts: 214
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?
Marco Ehrentreich
best scout
Bartender

Joined: Mar 07, 2007
Posts: 1280

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

Marco
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38851
    
  23
Too difficult a question for "beginning Java". Moving thread.
harish kshatrea
Greenhorn

Joined: Nov 20, 2009
Posts: 14
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!

Cheers,
Harry.
Marco Ehrentreich
best scout
Bartender

Joined: Mar 07, 2007
Posts: 1280

You're welcome Glad that it was helpful!

Marco
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: I have a few questions about Maven