• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Checkout from CVS using Maven

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Scoucers,

Can you please change your name in accordance with our naming policy. Thanks!
[ December 05, 2008: Message edited by: Martijn Verburg ]
 
Martijn Verburg
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Ronnie" please include a valid last name(no initials) as mentioned in the naming policy.
 
Martijn Verburg
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I guess you can simply get your 2nd project to call maven from the command line.
 
Ronnie D'costa
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ronnie, thanks for sharing your solution!
reply
    Bookmark Topic Watch Topic
  • New Topic