You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Kris Nuttycombe <Kr...@noaa.gov> on 2004/12/31 01:11:25 UTC
How to access dependency information in maven.xml?
Hi, all,
I have a situation where I need to be able to get dependency information
from my pom in my maven.xml file. What I'm trying to do is to overwrite
a properties file in a jar that is a dependency of my project. This is
for a warfile deployment, so the dependency is being copied into my
WEB-INF/lib directory, and I want to modify the jar there after the
war:webapp goal has copied it over. I've used that ant:jar task to do
this in the past with the name of the jarfile hardcoded in the
project.properties file, but it seems like there must be a better way to
go about this, by getting the name of the jarfile from the project
dependencies.
Any advice on how to go about doing this?
Thanks,
Kris
--
=====================================================
Kris Nuttycombe
Associate Scientist
Geospatial Data Services Group
CIRES, National Geophysical Data Center/NOAA
(303) 497-6337
Kris.Nuttycombe@noaa.gov
=====================================================
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: How to access dependency information in maven.xml?
Posted by Kris Nuttycombe <Kr...@noaa.gov>.
Never mind, I figured it out. I needed to be using
${pom.getDependency('geomag:geomag-jni')}. Thanks.
Kris
Kris Nuttycombe wrote:
> Does this work the same way in the maven.xml file as it does in the
> plugin? Here's my attempt:
>
> <postGoal name="war:webapp">
> <j:set var="dep" value="${pom.getDependency('geomag-jni')}"/>
> <echo>Using ${dep.artifactId} version ${dep.version}</echo>
>
> <echo>Updating jar ${maven.war.webapp.dir}/WEB-INF/lib/${dep.jar} for
> deployment on ${target.host}...</echo>
> <ant:jar destfile="${maven.war.webapp.dir}/WEB-INF/lib/${dep.jar}"
> update="yes">
> <ant:zipfileset
> file="${maven.conf.dir}/USHDResources-${target.host}.properties"
> fullpath="USHDResources.properties"/>
> </ant:jar>
> <ant:move file="${maven.war.webapp.dir}/WEB-INF/lib/${geomag.jni.jar}"
> tofile="${maven.build.dir}/${dep.artifactId}-${dep.version}-${target.host}.jar"/>
>
>
> <ant:copy file="${maven.conf.dir}/web-${target.host}.xml"
> tofile="${maven.war.webapp.dir}/WEB-INF/web.xml" overwrite="true"/>
> <ant:copy file="${maven.conf.dir}/log4j_conf-${target.host}.xml"
> tofile="${maven.war.webapp.dir}/WEB-INF/log4j_conf.xml"
> overwrite="true"/>
> <ant:copy file="${maven.conf.dir}/context-${target.host}.xml"
> tofile="${maven.war.webapp.dir}/META-INF/context.xml" overwrite="true"/>
> </postGoal>
>
> The ${pom.getDependency('geomag-jni')} doesn't appear to return
> anything, despite having this entry in my project.xml:
>
> <dependency>
> <groupId>geomag</groupId>
> <artifactId>geomag-jni</artifactId>
> <version>0.4.4</version>
> <url>http://gdsg.ndgc.noaa.gov/geomag</url>
> <properties>
> <war.bundle>true</war.bundle>
> </properties>
> <dependency>
>
> Here's the output from the war:webapp goal:
>
> war:webapp:
> [echo] Assembling webapp geomag-webapp
>
> <snip/>
>
> [echo] Using version
> [echo] Updating jar
> /home/kjn/work/geomag/webapp/target/geomag-webapp/WEB-INF/lib/ for
> deployment on sente...
> [jar] error while reading original manifest: Is a directory
>
> Thanks for your help. If I figure out the solution to this I'll add it
> to the wiki.
>
> Kris
>
>
>
> dan tran wrote:
>
>> take a look at maven-war-plugin's plugin.jelly.
>> should be in your $MAVEN_HOME/plugins/maven-war-plugin.jar
>>
>> -D
>>
>>
>> On Thu, 30 Dec 2004 17:11:25 -0700, Kris Nuttycombe
>> <Kr...@noaa.gov> wrote:
>>
>>
>>> Hi, all,
>>>
>>> I have a situation where I need to be able to get dependency
>>> information
>>> from my pom in my maven.xml file. What I'm trying to do is to overwrite
>>> a properties file in a jar that is a dependency of my project. This is
>>> for a warfile deployment, so the dependency is being copied into my
>>> WEB-INF/lib directory, and I want to modify the jar there after the
>>> war:webapp goal has copied it over. I've used that ant:jar task to do
>>> this in the past with the name of the jarfile hardcoded in the
>>> project.properties file, but it seems like there must be a better
>>> way to
>>> go about this, by getting the name of the jarfile from the project
>>> dependencies.
>>>
>>> Any advice on how to go about doing this?
>>>
>>> Thanks,
>>>
>>> Kris
>>>
>>> --
>>> =====================================================
>>> Kris Nuttycombe
>>> Associate Scientist
>>> Geospatial Data Services Group
>>> CIRES, National Geophysical Data Center/NOAA
>>> (303) 497-6337
>>> Kris.Nuttycombe@noaa.gov
>>> =====================================================
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>>
>>
>
--
=====================================================
Kris Nuttycombe
Associate Scientist
Geospatial Data Services Group
CIRES, National Geophysical Data Center/NOAA
(303) 497-6337
Kris.Nuttycombe@noaa.gov
=====================================================
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: How to access dependency information in maven.xml?
Posted by Kris Nuttycombe <Kr...@noaa.gov>.
Does this work the same way in the maven.xml file as it does in the
plugin? Here's my attempt:
<postGoal name="war:webapp">
<j:set var="dep" value="${pom.getDependency('geomag-jni')}"/>
<echo>Using ${dep.artifactId} version ${dep.version}</echo>
<echo>Updating jar ${maven.war.webapp.dir}/WEB-INF/lib/${dep.jar} for
deployment on ${target.host}...</echo>
<ant:jar destfile="${maven.war.webapp.dir}/WEB-INF/lib/${dep.jar}"
update="yes">
<ant:zipfileset
file="${maven.conf.dir}/USHDResources-${target.host}.properties"
fullpath="USHDResources.properties"/>
</ant:jar>
<ant:move file="${maven.war.webapp.dir}/WEB-INF/lib/${geomag.jni.jar}"
tofile="${maven.build.dir}/${dep.artifactId}-${dep.version}-${target.host}.jar"/>
<ant:copy file="${maven.conf.dir}/web-${target.host}.xml"
tofile="${maven.war.webapp.dir}/WEB-INF/web.xml" overwrite="true"/>
<ant:copy file="${maven.conf.dir}/log4j_conf-${target.host}.xml"
tofile="${maven.war.webapp.dir}/WEB-INF/log4j_conf.xml" overwrite="true"/>
<ant:copy file="${maven.conf.dir}/context-${target.host}.xml"
tofile="${maven.war.webapp.dir}/META-INF/context.xml" overwrite="true"/>
</postGoal>
The ${pom.getDependency('geomag-jni')} doesn't appear to return
anything, despite having this entry in my project.xml:
<dependency>
<groupId>geomag</groupId>
<artifactId>geomag-jni</artifactId>
<version>0.4.4</version>
<url>http://gdsg.ndgc.noaa.gov/geomag</url>
<properties>
<war.bundle>true</war.bundle>
</properties>
<dependency>
Here's the output from the war:webapp goal:
war:webapp:
[echo] Assembling webapp geomag-webapp
<snip/>
[echo] Using version
[echo] Updating jar
/home/kjn/work/geomag/webapp/target/geomag-webapp/WEB-INF/lib/ for
deployment on sente...
[jar] error while reading original manifest: Is a directory
Thanks for your help. If I figure out the solution to this I'll add it
to the wiki.
Kris
dan tran wrote:
>take a look at maven-war-plugin's plugin.jelly.
>should be in your $MAVEN_HOME/plugins/maven-war-plugin.jar
>
>-D
>
>
>On Thu, 30 Dec 2004 17:11:25 -0700, Kris Nuttycombe
><Kr...@noaa.gov> wrote:
>
>
>>Hi, all,
>>
>>I have a situation where I need to be able to get dependency information
>>from my pom in my maven.xml file. What I'm trying to do is to overwrite
>>a properties file in a jar that is a dependency of my project. This is
>>for a warfile deployment, so the dependency is being copied into my
>>WEB-INF/lib directory, and I want to modify the jar there after the
>>war:webapp goal has copied it over. I've used that ant:jar task to do
>>this in the past with the name of the jarfile hardcoded in the
>>project.properties file, but it seems like there must be a better way to
>>go about this, by getting the name of the jarfile from the project
>>dependencies.
>>
>>Any advice on how to go about doing this?
>>
>>Thanks,
>>
>>Kris
>>
>>--
>>=====================================================
>>Kris Nuttycombe
>>Associate Scientist
>>Geospatial Data Services Group
>>CIRES, National Geophysical Data Center/NOAA
>>(303) 497-6337
>>Kris.Nuttycombe@noaa.gov
>>=====================================================
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>>
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>For additional commands, e-mail: users-help@maven.apache.org
>
>
>
>
--
=====================================================
Kris Nuttycombe
Associate Scientist
Geospatial Data Services Group
CIRES, National Geophysical Data Center/NOAA
(303) 497-6337
Kris.Nuttycombe@noaa.gov
=====================================================
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: How to access dependency information in maven.xml?
Posted by dan tran <da...@gmail.com>.
take a look at maven-war-plugin's plugin.jelly.
should be in your $MAVEN_HOME/plugins/maven-war-plugin.jar
-D
On Thu, 30 Dec 2004 17:11:25 -0700, Kris Nuttycombe
<Kr...@noaa.gov> wrote:
> Hi, all,
>
> I have a situation where I need to be able to get dependency information
> from my pom in my maven.xml file. What I'm trying to do is to overwrite
> a properties file in a jar that is a dependency of my project. This is
> for a warfile deployment, so the dependency is being copied into my
> WEB-INF/lib directory, and I want to modify the jar there after the
> war:webapp goal has copied it over. I've used that ant:jar task to do
> this in the past with the name of the jarfile hardcoded in the
> project.properties file, but it seems like there must be a better way to
> go about this, by getting the name of the jarfile from the project
> dependencies.
>
> Any advice on how to go about doing this?
>
> Thanks,
>
> Kris
>
> --
> =====================================================
> Kris Nuttycombe
> Associate Scientist
> Geospatial Data Services Group
> CIRES, National Geophysical Data Center/NOAA
> (303) 497-6337
> Kris.Nuttycombe@noaa.gov
> =====================================================
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org