aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Checkout from CVS using Maven Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Checkout from CVS using Maven" Watch "Checkout from CVS using Maven" New topic
Author

Checkout from CVS using Maven

Ronnie D'costa
Greenhorn

Joined: Dec 05, 2008
Posts: 8
Hi All,

Newbie to Maven...

I am developing a tool that uses Maven for project management.
I am reading a file which has the details about the project that needs to be checked out from the CVS.

I am aware about the scm plugin for Maven. Since, I will be getting the project at runtime, I am not sure how to use this information in the POM.xml

Also, is it possible to run a sub-project independently from within a project.

Appreciate all your cooments

Thanks,
Scoucers
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Hi Scoucers,

Can you please change your name in accordance with our naming policy. Thanks!
[ December 05, 2008: Message edited by: Martijn Verburg ]

Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Right, now onto your question(s)

1.) I'm not really sure what you're trying to achieve here. Are you calling Maven from a Java program? Are you just having trouble configuring the SCM plugin?

2.) Maven has a concept of a parent pom which can contain several modules, that may be the project/subproject relationship you're looking for.
Ronnie D'costa
Greenhorn

Joined: Dec 05, 2008
Posts: 8
Thanks Martijn...

My issue is:

Part 1:
I currently have a project developed in Maven. Now I want to run tests from another project : say 'X'(name of this project would be available at runtime). In order to run tests from the project 'X', I need to check it out from the CVS. How can I achieve this using Maven or using JAVA code.

Part 2:
After downloading this project 'X'; how can I redirect the Maven to execute the tests from this project.

Please pour in your vital inputs on this
Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2718
    
    6

"Ronnie" please include a valid last name(no initials) as mentioned in the naming policy.


SCJP, SCWCD.
|Asking Good Questions|
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

I guess you can simply get your 2nd project to call maven from the command line.
Ronnie D'costa
Greenhorn

Joined: Dec 05, 2008
Posts: 8
Hi Martijn,

Thanks for your suggestion.

It seems I am not clear with my explanation about the problem.

As mentioned earlier; I will be downloading the project at runtime.
The project will be downloaded in one of the directories within my current project (may be src/main/java/project). Now I want to run the downloaded project which has its own build files (in case of ANT) and POM file (in case of Maven) from my current project.

At first place, is this possible to execute all together a nes project from within an existing project??? If yes... how to do that???

Regards,
Abhijit
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

By downloading the project at runtime do you mean from a Java program or from a Maven Project?

e.g. do you do this:

cd \project1
mvn scm:checkout
# This downloads project2 into project 1 e.g \project1\project2
# You want to automatically run the pom.xml in project2
Ronnie D'costa
Greenhorn

Joined: Dec 05, 2008
Posts: 8
Hi Martijn,

You are near to understanding my problem

This is what exactly happens:
I start with execution of project1 (say in directory C:\MyProjects\project1). During its execution it finds the download path of project2. It now checks out the project2 from CVS (at C:\MyProjects\project2). At this point, I want to execute the project2 (I simply have run the 'mvn test' command in the project2) directory.

Currently I am trying to run the 'mvn test' command using the 'getRuntime.exec()' method in java.

FYI ... I am able to run the project2 from the command line. I just need to know the way to execute it via 'getRuntime.exec()'.

If possible, can anyone provide./direct me to an example of this.

Waiting desperately for this one

Ronnie
Edwin Stephens
Greenhorn

Joined: Dec 30, 2008
Posts: 15
Hi Ronnie,

Perhaps this code will help you execute maven via the runtime exec? It calls the mvn.bat file in maven's bin directory (this is for execution on Windows), calling the test phase of the maven lifecycle. (Note that maven's bin directory needs to be on your path.) It executes on the "myproject2" project, which is located at C:\myworkspace\myproject2.





Hope that helps,
Edwin
Ronnie D'costa
Greenhorn

Joined: Dec 05, 2008
Posts: 8
Hey Edwin...

Thanks a lot man ... it really works !!!

Another way I found was the use of ProcessBuilder (for JDK1.5 and above)...
This is the next thing to the Runtime.exec

have a look at this example...



Wish you a Happy & Prosperous New Year!!!
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Hi Ronnie, thanks for sharing your solution!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Checkout from CVS using Maven