You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Webb Morris <we...@yahoo.com> on 2004/03/17 17:34:00 UTC

How do I change a pom property?

I have a need to change the pom.build.sourceDirectory parameter on the fly. I've tried the
following:

 <j:set var="pom.build.sourceDirectory" value="new value"/>

But this does not work. Ideas?

WM

__________________________________
Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam
http://mail.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: How do I change a pom property?

Posted by Webb Morris <we...@yahoo.com>.
Thanks John!

I'll try it out.

WM


--- John Casey <jd...@commonjava.org> wrote:
> Jason: undoubtedly, this is a hack, but it's one that I have also found
> to be required. Not having time to fix it (assuming it can be fixed) and
> pursue a patch, I've simply copied a section of the driver.jelly into a
> preGoal.
> 
> Webb: it's actually more involved than simply setting that property. You
> also have to reset the sourcesAvailable (or similar) properties for
> normal and unit test code. As you may begin to see, you will have
> started a relatively large snowball rolling.
> 
> Just to make your life easier, I'll include the section I use from a
> preGoal to take care of this. It's easiest to put it in the java:compile
> preGoal, I've found...
> 
> Good luck.
> -john
> 
> 
>   <!-- TASKS:
>    | 1. Create generated-source directory and copy all existing source
> to it.
>    | 2. Generate full java source via XDoclet.
>    | 3. Backup the maven.src.dir variable to maven.oldsrc.dir.
>    | 4. Re-init the sourcesPresent, maven.compile.src.set, etc.
>    |-->
>   <preGoal name="java:compile">
>     <c:if test="${empty(maven.gensrc.dir)}">
>       <c:set var="maven.gensrc.dir"
> value="${maven.build.dir}/generated-source"/>
>     </c:if>
>     
>   	<ant:taskdef classname="xdoclet.modules.ejb.EjbDocletTask"
> 	               name="ejbdoclet">
> 	    <ant:classpath>
> 	      <ant:path refid="maven.dependency.classpath" />
> 	    </ant:classpath>
> 	  </ant:taskdef>
> 
>     <ant:mkdir dir="${maven.gensrc.dir}"/>
>     <ant:copy todir="${maven.gensrc.dir}">
>       <ant:fileset dir="${pom.build.sourceDirectory}">
>         <ant:exclude name=".dependency-info/**"/>
>       </ant:fileset>
>     </ant:copy>
>   
>     <ant:echo>Starting EJBDoclet...</ant:echo>
> 	  <ant:ejbdoclet ejbSpec="2.0"
>                    excludedTags="@version,@author,@todo"
>                    destDir="${maven.gensrc.dir}"
>                    verbose="false">
> 
>       <ant:fileset dir="${maven.gensrc.dir}"  includes="**/*Bean.java"
> />
>       <ant:remoteinterface/>
>       <ant:localinterface/>
>       <ant:homeinterface/>
>       <ant:localhomeinterface/>
>       <ant:jboss validateXML="true" 
>                  destDir="${maven.gensrc.dir}/META-INF"
>                  generateRelations="false"
>                  mergeDir="${basedir}/xdoclet-mergeSrc"
>                  version="3.2"/>
>       <ant:deploymentdescriptor validateXML="true"  
>                                 destDir="${maven.gensrc.dir}/META-INF"
> />
>     </ant:ejbdoclet>
>     <ant:echo>...Finished EJBDoclet</ant:echo>
>       <!--                                
>       <ant:jrun validateXML="true" 
> destDir="${maven.gensrc.dir}/META-INF" />
>       -->
> 		
>     <c:set var="maven.oldsrc.dir" value="${maven.src.dir}"/>
>     <c:set var="maven.src.dir" value="${maven.gensrc.dir}"/>
>     
>     <c:set target="${pom.build}" property="sourceDirectory"
> value="${maven.src.dir}"/>
>     
>     <ant:echo>maven.src.dir is now ${maven.src.dir}</ant:echo>
>     <ant:echo>pom.build.sourceDirectory is now
> ${pom.build.sourceDirectory}</ant:echo>
>     
>     <!-- Swiped
> from:                                                       -->
>     <!--
> ================================================================== -->
>     <!-- D R I V E R  I N I T I A L I Z A T I O
> N                           -->
>     <!--
> ================================================================== -->
>     <!-- All things we want to provide to all plugins, or processes
> we      -->
>     <!-- performed before every build are declared/defined
> here.            -->
>     <!--
> ================================================================== -->
> 
>     <c:if test="${!empty(maven.src.dir)}">
>       <ant:available property="sourcesPresent" file="${maven.src.dir}"/>
>     </c:if>
> 
>     <ant:path id="maven-classpath">
>       <ant:fileset dir="${maven.home}/lib"/>
>     </ant:path>
> 
>     <c:if test="${sourcesPresent == 'true'}">
>       <!--
>        | FIXME: It would be nice for other plugins to have the source
> available
>        |        as a fileset
>        |-->
>       <ant:path id="maven.compile.src.set">
>         <ant:pathelement location="${maven.src.dir}"/>
>       </ant:path>
>     </c:if>
> 
> 
> On Wed, 2004-03-17 at 12:19, Webb Morris wrote:
> > Well,
> > 
> > I have a plugin that generates an EJB from a service class. The EJB doesn't get placed in the
> > pom.build.sourceDirectory structure, because that wouldn't make sense (don't want the EJB
> checked
> > in to source repository, don't want users to go fiddling with it outside of generation, etc). 
> The
> > next thing that needs to happen is to generate the Remotes and Homes etc. using the XDoclet
> > EJBDoclet plugin.  Unfortunately, that plugin looks for the files to include in the
> > pom.build.sourceDirectory structure instead of some user settable property.  Therefore, I need
> to
> > change the value of this variable before I make the xdoclet:ejbdoclet call.
> > 
> > So, how can I do this?
> > 
> > WM
> > 
> > 
> > --- Jason van Zyl <jv...@maven.org> wrote:
> > > On Wed, 2004-03-17 at 11:34, Webb Morris wrote:
> > > > I have a need to change the pom.build.sourceDirectory parameter on the fly. I've tried the
> > > > following:
> > > > 
> > > >  <j:set var="pom.build.sourceDirectory" value="new value"/>
> > > > 
> > > > But this does not work. Ideas?
> > > 
> > > You can make it work, but why exactly are you trying to do that? You
> > > shouldn't need to.
> > > 
> > > > WM
> > > > 
> > > > __________________________________
> > > > Do you Yahoo!?
> > > > Yahoo! Mail - More reliable, more storage, less spam
> > > > http://mail.yahoo.com
> > > > 
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > > For additional commands, e-mail: users-help@maven.apache.org
> > > 
> > > -- 
> > > jvz.
> > > 
> > > Jason van Zyl
> > > jason@maven.org
> > > http://maven.apache.org
> > > 
> > > happiness is like a butterfly: the more you chase it, the more it will
> > > elude you, but if you turn your attention to other things, it will come
> > > and sit softly on your shoulder ...
> > > 
> > >  -- Thoreau 
> > > 
> > > 
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > > 
> > 
> > 
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! Mail - More reliable, more storage, less spam
> > http://mail.yahoo.com
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> -- 
> John Casey
> jdcasey@commonjava.org
> CommonJava Open Components Project
> http://www.commonjava.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 


__________________________________
Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam
http://mail.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: How do I change a pom property?

Posted by John Casey <jd...@commonjava.org>.
Jason: undoubtedly, this is a hack, but it's one that I have also found
to be required. Not having time to fix it (assuming it can be fixed) and
pursue a patch, I've simply copied a section of the driver.jelly into a
preGoal.

Webb: it's actually more involved than simply setting that property. You
also have to reset the sourcesAvailable (or similar) properties for
normal and unit test code. As you may begin to see, you will have
started a relatively large snowball rolling.

Just to make your life easier, I'll include the section I use from a
preGoal to take care of this. It's easiest to put it in the java:compile
preGoal, I've found...

Good luck.
-john


  <!-- TASKS:
   | 1. Create generated-source directory and copy all existing source
to it.
   | 2. Generate full java source via XDoclet.
   | 3. Backup the maven.src.dir variable to maven.oldsrc.dir.
   | 4. Re-init the sourcesPresent, maven.compile.src.set, etc.
   |-->
  <preGoal name="java:compile">
    <c:if test="${empty(maven.gensrc.dir)}">
      <c:set var="maven.gensrc.dir"
value="${maven.build.dir}/generated-source"/>
    </c:if>
    
  	<ant:taskdef classname="xdoclet.modules.ejb.EjbDocletTask"
	               name="ejbdoclet">
	    <ant:classpath>
	      <ant:path refid="maven.dependency.classpath" />
	    </ant:classpath>
	  </ant:taskdef>

    <ant:mkdir dir="${maven.gensrc.dir}"/>
    <ant:copy todir="${maven.gensrc.dir}">
      <ant:fileset dir="${pom.build.sourceDirectory}">
        <ant:exclude name=".dependency-info/**"/>
      </ant:fileset>
    </ant:copy>
  
    <ant:echo>Starting EJBDoclet...</ant:echo>
	  <ant:ejbdoclet ejbSpec="2.0"
                   excludedTags="@version,@author,@todo"
                   destDir="${maven.gensrc.dir}"
                   verbose="false">

      <ant:fileset dir="${maven.gensrc.dir}"  includes="**/*Bean.java"
/>
      <ant:remoteinterface/>
      <ant:localinterface/>
      <ant:homeinterface/>
      <ant:localhomeinterface/>
      <ant:jboss validateXML="true" 
                 destDir="${maven.gensrc.dir}/META-INF"
                 generateRelations="false"
                 mergeDir="${basedir}/xdoclet-mergeSrc"
                 version="3.2"/>
      <ant:deploymentdescriptor validateXML="true"  
                                destDir="${maven.gensrc.dir}/META-INF"
/>
    </ant:ejbdoclet>
    <ant:echo>...Finished EJBDoclet</ant:echo>
      <!--                                
      <ant:jrun validateXML="true" 
destDir="${maven.gensrc.dir}/META-INF" />
      -->
		
    <c:set var="maven.oldsrc.dir" value="${maven.src.dir}"/>
    <c:set var="maven.src.dir" value="${maven.gensrc.dir}"/>
    
    <c:set target="${pom.build}" property="sourceDirectory"
value="${maven.src.dir}"/>
    
    <ant:echo>maven.src.dir is now ${maven.src.dir}</ant:echo>
    <ant:echo>pom.build.sourceDirectory is now
${pom.build.sourceDirectory}</ant:echo>
    
    <!-- Swiped
from:                                                       -->
    <!--
================================================================== -->
    <!-- D R I V E R  I N I T I A L I Z A T I O
N                           -->
    <!--
================================================================== -->
    <!-- All things we want to provide to all plugins, or processes
we      -->
    <!-- performed before every build are declared/defined
here.            -->
    <!--
================================================================== -->

    <c:if test="${!empty(maven.src.dir)}">
      <ant:available property="sourcesPresent" file="${maven.src.dir}"/>
    </c:if>

    <ant:path id="maven-classpath">
      <ant:fileset dir="${maven.home}/lib"/>
    </ant:path>

    <c:if test="${sourcesPresent == 'true'}">
      <!--
       | FIXME: It would be nice for other plugins to have the source
available
       |        as a fileset
       |-->
      <ant:path id="maven.compile.src.set">
        <ant:pathelement location="${maven.src.dir}"/>
      </ant:path>
    </c:if>


On Wed, 2004-03-17 at 12:19, Webb Morris wrote:
> Well,
> 
> I have a plugin that generates an EJB from a service class. The EJB doesn't get placed in the
> pom.build.sourceDirectory structure, because that wouldn't make sense (don't want the EJB checked
> in to source repository, don't want users to go fiddling with it outside of generation, etc).  The
> next thing that needs to happen is to generate the Remotes and Homes etc. using the XDoclet
> EJBDoclet plugin.  Unfortunately, that plugin looks for the files to include in the
> pom.build.sourceDirectory structure instead of some user settable property.  Therefore, I need to
> change the value of this variable before I make the xdoclet:ejbdoclet call.
> 
> So, how can I do this?
> 
> WM
> 
> 
> --- Jason van Zyl <jv...@maven.org> wrote:
> > On Wed, 2004-03-17 at 11:34, Webb Morris wrote:
> > > I have a need to change the pom.build.sourceDirectory parameter on the fly. I've tried the
> > > following:
> > > 
> > >  <j:set var="pom.build.sourceDirectory" value="new value"/>
> > > 
> > > But this does not work. Ideas?
> > 
> > You can make it work, but why exactly are you trying to do that? You
> > shouldn't need to.
> > 
> > > WM
> > > 
> > > __________________________________
> > > Do you Yahoo!?
> > > Yahoo! Mail - More reliable, more storage, less spam
> > > http://mail.yahoo.com
> > > 
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > 
> > -- 
> > jvz.
> > 
> > Jason van Zyl
> > jason@maven.org
> > http://maven.apache.org
> > 
> > happiness is like a butterfly: the more you chase it, the more it will
> > elude you, but if you turn your attention to other things, it will come
> > and sit softly on your shoulder ...
> > 
> >  -- Thoreau 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> > 
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail - More reliable, more storage, less spam
> http://mail.yahoo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
-- 
John Casey
jdcasey@commonjava.org
CommonJava Open Components Project
http://www.commonjava.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: How do I change a pom property?

Posted by Webb Morris <we...@yahoo.com>.
Well,

I have a plugin that generates an EJB from a service class. The EJB doesn't get placed in the
pom.build.sourceDirectory structure, because that wouldn't make sense (don't want the EJB checked
in to source repository, don't want users to go fiddling with it outside of generation, etc).  The
next thing that needs to happen is to generate the Remotes and Homes etc. using the XDoclet
EJBDoclet plugin.  Unfortunately, that plugin looks for the files to include in the
pom.build.sourceDirectory structure instead of some user settable property.  Therefore, I need to
change the value of this variable before I make the xdoclet:ejbdoclet call.

So, how can I do this?

WM


--- Jason van Zyl <jv...@maven.org> wrote:
> On Wed, 2004-03-17 at 11:34, Webb Morris wrote:
> > I have a need to change the pom.build.sourceDirectory parameter on the fly. I've tried the
> > following:
> > 
> >  <j:set var="pom.build.sourceDirectory" value="new value"/>
> > 
> > But this does not work. Ideas?
> 
> You can make it work, but why exactly are you trying to do that? You
> shouldn't need to.
> 
> > WM
> > 
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! Mail - More reliable, more storage, less spam
> > http://mail.yahoo.com
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> 
> -- 
> jvz.
> 
> Jason van Zyl
> jason@maven.org
> http://maven.apache.org
> 
> happiness is like a butterfly: the more you chase it, the more it will
> elude you, but if you turn your attention to other things, it will come
> and sit softly on your shoulder ...
> 
>  -- Thoreau 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 


__________________________________
Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam
http://mail.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: How do I change a pom property?

Posted by Jason van Zyl <jv...@maven.org>.
On Wed, 2004-03-17 at 11:34, Webb Morris wrote:
> I have a need to change the pom.build.sourceDirectory parameter on the fly. I've tried the
> following:
> 
>  <j:set var="pom.build.sourceDirectory" value="new value"/>
> 
> But this does not work. Ideas?

You can make it work, but why exactly are you trying to do that? You
shouldn't need to.

> WM
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail - More reliable, more storage, less spam
> http://mail.yahoo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org

-- 
jvz.

Jason van Zyl
jason@maven.org
http://maven.apache.org

happiness is like a butterfly: the more you chase it, the more it will
elude you, but if you turn your attention to other things, it will come
and sit softly on your shoulder ...

 -- Thoreau 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org