This is the structure I was referring to:

Projects
   |---Builds
   |     |---maven.xml
   |     |---project.properties
   |     |---project.xml
   |     |---Portfolio (multiproject build directory)
   |     |---...
   | 
   |---proj1
   |---proj2
   |---proj3
   |---Portfolio (proj4)
   |--- ...


Attached are some of the files I was referring to. Portfolio is a
project name.  

The small project.xml and the project.properties file would be in the
Projects/Builds/Portfolio directory. 

The large project.xml file would be in Projects/Portfolio.

The maven.xml file is the main maven.xml file that would go under the
Builds directory. The 'parseproject' goal is probably what you are
looking for. It requires a property called 'cc.proj' set inside the
dependency section of each dependency in the project's project.xml file.
You would run from the Projects/Builds/Portfolio directory like:

maven -Dmaven.scm.cvs.root=<your cvsroot> parseproject

What it does is parse the project.xml file downloading the dependency
source from cvs and rewriting the project.properties file to add the
maven.ccmultiproject.includes property. That will be used by the
multiproject goals run within the Projects/Builds/Portfolio directory to
only run on the dependency projects. 

I'm a little rusty on some of the specifics, but you can probably get
the idea of how it works.

I'm also interested in hearing how others have solved this type of
problem so I can streamline the process. In the past, I have created
custom solutions for maven only to find out that there was a simple
command or property to do the same thing, but either I never found
documentation for the feature or I misunderstood it.


Eric



On Thu, 2005-03-03 at 10:03 -0500, Maven Users List wrote:
> Hi,
> 
> 
> There are probably many ways that developers have created there own
> scheme, but what I did was to create a 'builds' directory on the same
> level as the apps(I'll call them projects) where common project.xml,
> maven.xml, and project.properties files go and are extended within
> each
> project's own maven files. In that same builds directory, I created a
> subdirectory for the important apps with a project.xml with only the
> project name within it so I could just checkout the builds
> directory(or
> keep it local) and run checkouts and multiproject goals against them.
> 
> 
> This may be different than what you are looking for. In our case, each
> project is a standalone project as well as a potential dependency of
> another project. I've created some plugins and maven goals to deal
> with
> creating multiproject.includes on the fly based on dependencies, etc.
> 
> 
> I hope this helps...
> 
> 
> Eric 
> 
> 
> 
> 
> 
> 
> On Thu, 2005-03-03 at 09:30 -0500, Maven Users List wrote:
> > hi ..
> > 
> > 
> > its my duty to migrate from ant to maven ..
> > 
> > 
> > we have the following source-structure
> > 
> > 
> > com
> >   | -- foo
> >         | -- app1
> >         | -- app2
> >         | -- app3
> > 
> > 
> > i created three subprojects for each of the apps ...
> > the next thing i would like to do is to tell maven in the
> project.xml
> > that
> > it should only checkout the specific files in the appX area.
> > 
> > 
> > how do i achieve this ???
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
<?xml version="1.0"?>

<project 
  xmlns:j="jelly:core"
  xmlns:x="jelly:xml"
  xmlns:u="jelly:util"
  xmlns:ant="jelly:ant"
  xmlns:maven="jelly:maven">

  <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 
  <!--	                                                          -->
  <!--	Using multiproject setups:                                -->
  <!--                                                            -->
  <!--  Uses the directory structure that we currently have set   -->
  <!--  up where all projects are parallel to one another, the    -->
  <!--  Builds directory is parallel as well, and major project   -->
  <!--  multiproject goals are run from one directory below the   -->
  <!--  Builds directory:                                         -->
  <!--                                                            -->
  <!--      Projects                                              -->
  <!--          |..Builds                                         -->
  <!--          |    |..Pedagogica (multiproject build dir)       -->
  <!--          |    |      .                                     -->
  <!--          |    |      .                                     -->
  <!--          |    |      .                                     -->
  <!--          |    |..Portfolio (multiproject build dir)        -->
  <!--          |                                                 -->
  <!--          |..Activity                                       -->
  <!--          |     .                                           -->
  <!--          |     .                                           -->
  <!--          |     .                                           -->
  <!--          |..Pedagogica                                     -->
  <!--          |..Portfolio                                      -->
  <!--	                                                          -->
  <!-- Run all major project goals in the Builds/${project} dir.  -->
  <!--	                                                          -->
  <!-- To create the structure:                                   -->
  <!--	    Use the parseproject goal. This creates the           -->
  <!--	    project.properties file for the major project.        -->
  <!--	    To prevent downloading of dependent projects, set     -->
  <!--	    the property "download=false" (-Ddownload=false).     -->
  <!--	                                                          -->
  <!-- To check out only the project:                             -->
  <!--	    Use the projectco goal.                               -->
  <!--	                                                          -->
  <!-- To run multiproject goals:                                 -->
  <!--	    Use the maven multiproject goals after running        -->
  <!--	    parseproject goal to create the project.properties    -->
  <!--      file for the main project.                            -->
  <!--	                                                          -->
  <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->



  <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 
  <!--	                                                          -->
  <!--  Goal for running CC specific multiproject goals. The idea -->
  <!--  is to build the maven.multiproject.includes path from the -->
  <!--  dependencies listed in poms, using the cc.proj property.  -->
  <!--                                                            -->
  <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  <preGoal name="multiproject:projects-init">
     <attainGoal name="init-multiproject-path" />
  </preGoal>

  <goal name="init-multiproject-path">
    <j:set var="run" value="${maven.ccmultiproject.run}" />

    <j:if test="${empty(run)}">
      <ant:echo message="Running CC multiproject pregoal to set maven.multiproject.includes." />
      <ant:echo message="To disable, set maven.ccmultiproject.run property to non-empty." />

      <maven:paramCheck fail="no" value="${maven.multiproject.basedir}" 
             message="WARNING: maven.multiproject.basedir is not set. Assumming current directory."/>

      <maven:get var="multiIncludes" plugin="maven-multiproject-plugin" property="maven.multiproject.includes" />
      <j:if test="${multiIncludes != '*/project.xml'}">
        <ant:fail message="Do not use maven.multiproject.includes property to add paths, use maven.ccmultiproject.includes instead." />
      </j:if>
      <j:set var="includes" value="${maven.ccmultiproject.includes}" />

      <!-- Build the classpath from the pom dependency cc.proj properties -->
      <j:forEach var="externJar" items="${pom.artifacts}">
        <j:set var="ccPath" value="${externJar.dependency.getProperty('cc.proj')}" />
        <j:if test="${!empty(ccPath)}">
          <j:set var="projpath" value="${maven.multiproject.basedir}/${ccPath}/project.xml" />
	
          <j:set var="fileExists" value="false" />
          <u:available file="../../${name}/project.xml">
	    <j:set var="fileExists" value="true" />
	  </u:available>

          <j:if test="${fileExists == 'true'}">
	    <j:if test="${empty(includes)}">
              <j:set var="includes" value="${ccPath}/project.xml" />
            </j:if>
	    <j:if test="${!empty(includes)}">
              <j:set var="includes" value="${includes},${ccPath}/project.xml" />
            </j:if>
          </j:if>
        </j:if>
      </j:forEach>

      <ant:echo message="maven.multiproject.includes=${includes}" />
      <j:if test="${empty(includes)}">
        <maven:set plugin="maven-multiproject-plugin" 
                   property="maven.multiproject.includes" 
                   value="*/project.xml" />      
      </j:if>
      <j:if test="${!empty(includes)}">
        <maven:set plugin="maven-multiproject-plugin" 
                   property="maven.multiproject.includes" 
                   value="${includes}" />      
      </j:if>
    </j:if>
  </goal>


  <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ --> 
  <!--	                                                          -->
  <!--  This goal is used to create the multiproject properties   -->
  <!--  for major projects by parsing the main project's          -->
  <!--  project.xml file. It sets maven.ccmultiproject.includes   -->
  <!--  to include dependencies from the main project.xml.        -->
  <!--                                                            -->
  <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  <goal name="parseproject">
    <j:set var="projExists" value="false" />
    <u:available file="../../${pom.name}">
      <j:set var="projExists" value="true" />
    </u:available>

    <j:new className="java.util.HashMap" var="hash" />
    <j:invoke on="${hash}" method="clear" var="dummy" />

    <j:if test="${projExists != 'true'}">
      <attainGoal name="projectco" />
    </j:if>

    <j:set var="includes" value="${pom.name}/project.xml" />

    <j:set var="projectfile" 
           value="../../${pom.name}/project.xml" />
    <attainGoal name="parsexml" />

    <ant:echo message="Setting includes: ${includes}" />
    <j:file name="project.properties" 
            outputMode="html" 
            escapeText="false" 
            omitXmlDeclaration="true">
maven.multiproject.basedir=../..
maven.ccmultiproject.includes=${includes}
    </j:file>
  </goal>

  <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  <!--                                                            -->
  <!-- Project.xml parsing goal.                                  -->
  <!--                                                            -->
  <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  <goal name="parsexml">
    <ant:echo message="Parsing '${projectfile}'" />
    <x:parse xml="${projectfile}" var="doc" />
    <x:forEach var="file" select="$doc/project/dependencies/dependency" trim="yes">
      <x:set var="name" select="string($file/properties/cc.proj)" />
      <j:if test="${!empty(name)}">
        <ant:echo message="Project '${name}' set for inclusion" />

	<!-- This will set ${return} to a previous value if it exists -->
        <j:invoke on="${hash}" method="put" var="return">
	  <j:arg value="${name}/project.xml" />
	  <j:arg value="exists" />
	</j:invoke>

        <!-- <ant:echo message="${name} RETURN: ${return}" /> -->
        <j:if test="${return != 'exists'}">
    	  <j:choose>
	    <j:when test="${empty(includes)}">
              <j:set var="includes" value="${name}/project.xml" />
	    </j:when>
	    <j:otherwise>
              <j:set var="includes" value="${includes},${name}/project.xml" />
	    </j:otherwise>
	  </j:choose>
	
          <j:set var="fileExists" value="false" />
          <u:available file="../../${name}/project.xml">
	    <j:set var="fileExists" value="true" />
	  </u:available>

          <j:if test="${fileExists == 'false'}">
	    <ant:echo message="WARNING: ${name}/project.xml does not exist!" />
	    <j:if test="${download == 'no'}">
	      <j:set var="download" value="false" />
            </j:if>

	    <j:if test="${download != 'false'}">
	      <ant:echo message="         Checking out project '${name}'..." />
	      <j:set var="ccScm.cvs.module" value="Projects/${name}" />
	      <attainGoal name="projectco" />
              <j:set var="fileExists" value="true" />
            </j:if>
	  </j:if>

          <j:if test="${fileExists == 'true'}">
            <j:set var="projectfile" value="../../${name}/project.xml" />
	    <attainGoal name="parsexml" />
          </j:if>
        </j:if>          
      </j:if>
    </x:forEach>
  </goal>

  <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  <!--                                                            -->
  <!-- This goal is used to check out a project from cvs.         -->
  <!--                                                            -->
  <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  <goal name="projectco" description="Checkout project defined by ccScm.cvs.module">  
    <!-- Check the input required variables -->
    <ant:property environment="env" />

    <!-- Test the input parameters. Properties are most important, -->
    <!-- maven.scm.cvs.root, then CVSROOT setting. -->
    <j:set var="projcvsroot" value="${maven.scm.cvs.root}" />
    <j:if test="${empty(projcvsroot)}">
      <ant:echo message="maven.scm.cvs.root is not defined" />
      <j:set var="projcvsroot" value="${env.CVSROOT}" />
      <j:if test="${empty(projcvsroot)}">
        <ant:echo message="Environment variable CVSROOT is not defined" />
      </j:if>	
    </j:if>

    <j:if test="${empty(projcvsroot)}">
       <ant:echo message="Required properties are not set. Read checkvars output to determine problem." />
       <ant:echo message="    Notes: maven.scm.cvs.root should be set like CVSROOT env variable" />
       <ant:echo message="           CVS_RSH must be set if using :ext: cvs server method." />
       <ant:fail message="Required properties are not set. Read checkvars output to determine problem." />
    </j:if>

    <j:set var="module" value="${ccScm.cvs.module}" />

    <ant:echo message="Checking out module: ${module}"/>
    <j:set var="maven.scm.cvs.module" value="${module}" />
    <j:if test="${empty(maven.scm.checkout.dir)}">
      <j:set var="maven.scm.checkout.dir" value="../../../" />
    </j:if>

    <!-- Leaving the following line in case I have problems, -->
    <!-- doesn't seem to be necessary though -->
    <!--    <attainGoal session="${context.getVariable('maven.session.global', 'parent')}" -->
    <!--            name="scm:checkout-project" /> -->
    <attainGoal name="scm:checkout-project" />
    <ant:echo message="Done" />  
  </goal>

  <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  <!--                                                            -->
  <!-- This pregoal is used to create the Class-path elements in  -->
  <!-- the project jar file's manifest by calling CC's plugin.    -->
  <!--                                                            -->
  <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  <preGoal name="jar:jar">
    <attainGoal name="ccmanifest" />
  </preGoal>

  <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  <!--                                                            -->
  <!-- Since setting maven.build.dir or maven.build.dest will     -->
  <!-- effect most built residuals, create this post goal to get  -->
  <!-- just the jar file into the lib directory.                  -->
  <!--                                                            -->
  <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  <postGoal name="jar:jar">
    <ant:mkdir dir="${basedir}/lib" />
    <!-- Copy the jar file to the lib directory -->
    <ant:copy file="${maven.build.dir}/${maven.final.name}.jar" todir="${basedir}/lib" />
    <ant:copy file="${maven.build.dir}/${maven.final.name}.jar"
              tofile="${basedir}/lib/${pom.artifactId}-SNAPSHOT.jar" />
  </postGoal>

  <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  <!--                                                            -->
  <!-- Extend the cleanup to remove the extra 'lib' and 'conf'    -->
  <!-- directory.                                                 -->
  <!--                                                            -->
  <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  <postGoal name="clean:clean">
    <ant:delete dir="${basedir}/lib" />
    <ant:delete dir="${basedir}/conf" />
  </postGoal>

</project>
<?xml version="1.0" encoding="UTF-8"?>
<project>
  <!-- Inherit main project xml file -->
  <extend>../project.xml</extend>

  <name>Portfolio</name>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<project>
  <pomVersion>3</pomVersion>
  <artifactId>portfolio</artifactId>
  <name>Portfolio</name>
  <groupId>portfolio</groupId>
  <currentVersion>4.5.4</currentVersion>
  <organization>
    <name>Concord Consoritum</name>
  </organization>
  <inceptionYear>2004</inceptionYear>
  <logo>/images/logo.gif</logo>
  <mailingLists>
    <mailingList>
      <name>${pom.name} Dev List</name>
    </mailingList>
    <mailingList>
      <name>${pom.name} User List</name>
    </mailingList>
  </mailingLists>
  <dependencies>
    <dependency>
      <groupId>domain</groupId>
      <artifactId>domain</artifactId>
      <version>1.0</version>
      <type>jar</type>
      <properties>
        <cc.proj>Domain</cc.proj>
        <eclipse.dependency>true</eclipse.dependency>
        <jnlp.jar>true</jnlp.jar>
      </properties>
    </dependency>
    <dependency>
      <groupId>framework</groupId>
      <artifactId>framework</artifactId>
      <version>SNAPSHOT</version>
      <type>jar</type>
      <properties>
        <cc.proj>Framework</cc.proj>
        <eclipse.dependency>true</eclipse.dependency>
        <jnlp.jar>true</jnlp.jar>
      </properties>
    </dependency>
    <dependency>
      <groupId>otrunk</groupId>
      <artifactId>otrunk</artifactId>
      <version>SNAPSHOT</version>
      <type>jar</type>
      <properties>
        <cc.proj>OTrunk</cc.proj>
        <eclipse.dependency>true</eclipse.dependency>
        <jnlp.jar>true</jnlp.jar>
      </properties>
    </dependency>
    <dependency>
      <groupId>data</groupId>
      <artifactId>data</artifactId>
      <version>SNAPSHOT</version>
      <type>jar</type>
      <properties>
        <cc.proj>Data</cc.proj>
        <eclipse.dependency>true</eclipse.dependency>
        <jnlp.jar>true</jnlp.jar>
      </properties>
    </dependency>
    <dependency>
      <groupId>datagraph</groupId>
      <artifactId>datagraph</artifactId>
      <version>SNAPSHOT</version>
      <type>jar</type>
      <properties>
        <cc.proj>DataGraph</cc.proj>
        <eclipse.dependency>true</eclipse.dependency>
        <jnlp.jar>true</jnlp.jar>
      </properties>
    </dependency>
    <dependency>
      <groupId>hsqldb</groupId>
      <artifactId>hsqldb</artifactId>
      <version>1.6.1</version>
      <type>jar</type>
    </dependency>
    <dependency>
      <groupId>jug</groupId>
      <artifactId>jug</artifactId>
      <version>1.1</version>
      <type>jar</type>
      <properties>
        <jnlp.jar>true</jnlp.jar>
      </properties>
    </dependency>
    <dependency>
      <groupId>frameworkview</groupId>
      <artifactId>frameworkview</artifactId>
      <version>SNAPSHOT</version>
      <type>jar</type>
      <properties>
        <cc.proj>FrameworkView</cc.proj>
        <jnlp.jar>true</jnlp.jar>
      </properties>
    </dependency>
    <dependency>
      <groupId>jdom</groupId>
      <artifactId>jdom</artifactId>
      <version>1.0</version>
      <type>jar</type>
      <properties>
        <jnlp.jar>true</jnlp.jar>
      </properties>
    </dependency>
    <dependency>
      <groupId>graph</groupId>
      <artifactId>graph</artifactId>
      <version>SNAPSHOT</version>
      <type>jar</type>
      <properties>
        <cc.proj>Graph</cc.proj>
        <jnlp.jar>true</jnlp.jar>
      </properties>
    </dependency>
    <dependency>
      <groupId>sensor</groupId>
      <artifactId>sensor</artifactId>
      <version>SNAPSHOT</version>
      <type>jar</type>
      <properties>
        <jnlp.jar>true</jnlp.jar>
        <cc.proj>Sensor</cc.proj>
      </properties>
    </dependency>
    <dependency>
      <groupId>sensornative</groupId>
      <artifactId>sensornative</artifactId>
      <version>SNAPSHOT</version>
      <type>jar</type>
      <properties>
        <cc.proj>SensorNative</cc.proj>        
        <jnlp.jar>true</jnlp.jar>
      </properties>
    </dependency>
    <dependency>
      <groupId>sync4j</groupId>
      <artifactId>sc-api-j2se</artifactId>
      <version>2.6</version>
      <type>jar</type>
    </dependency>
    <dependency>
      <groupId>flyingsaucer</groupId>
      <artifactId>core-renderer</artifactId>
      <version>cc-1.0-beta4</version>
      <type>jar</type>
      <properties>
        <jnlp.jar>true</jnlp.jar>
      </properties>
    </dependency>
    <dependency>
      <groupId>steadystate</groupId>
      <artifactId>ss_css2</artifactId>
      <version>0.9.3</version>
      <type>jar</type>
      <properties>
        <jnlp.jar>true</jnlp.jar>
      </properties>
    </dependency>
    <dependency>
      <groupId>waba</groupId>
      <artifactId>wabajvm</artifactId>
      <version>1.0</version>
      <type>jar</type>
      <properties>
        <jnlp.jar>true</jnlp.jar>
      </properties>
    </dependency>
  </dependencies>
  <build>
    <sourceDirectory>src/java</sourceDirectory>
    <unitTestSourceDirectory>src/test</unitTestSourceDirectory>
    <unitTest>
      <includes>
        <include>**/*Test.java</include>
      </includes>
    </unitTest>
  </build>
</project>
maven.multiproject.basedir=../..

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to