ant-ivy-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kent Larsson" <kent.lars...@gmail.com>
Subject Re: Clean way to differ between runtime and compile time dependencies? (So I do not include runtime deps in my war)
Date Mon, 12 Jan 2009 00:33:28 GMT
Thank you for helping me out Mitch, I appreciate it!

I see what you did with those two configurations. I'll retrieve them
all and create classpaths from their config directories then. I guess
one directory will hold compile + runtime dependencies and the other
only runtime dependencies. It seems like a nice solution!

For the publications part, I don't have a local repository to publish
anything. And the project isn't really a dependency of any other
company project. Also it's not dependent on any other project created
by our company. That's why I used Ivy only to retrieve the
dependencies, and I built the war myself and put it where it should
go. As I'm new to Ivy maybe there are some advantages of having
<publications> to a local repository in my situation I'm missing? Or
should I continue as I am doing it?

When it comes to the Wicket dependency I'm not sure if I understood
you. It's a project not created by our company. We retrieve everything
from the Maven2 repositories. If you are suggestion that I should
change the pom.xml in the Maven2 repository then I can't as it's not
under my control. Please elaborate a bit, I might just misunderstand
you and there's something I can do to improve our build process.

Many thanks for answering!

Best regards, Kent

On Sun, Jan 11, 2009 at 11:33 PM, Mitch Gitman <mgitman@gmail.com> wrote:
> I haven't bothered to test this, so I may have gotten a detail wrong, but
> here are some small additions to your ivy.xml file to filter out the servlet
> API JAR:
> <ivy-module version="2.0">
>  <info organisation="domain.organisation" module="webproject" />
>
>  <configurations>
>    <conf name="runtime" description="everything except the servlet API" />
>    <conf name="compile" extends="runtime" description="Plus the servlet
> API" />
>  </configurations>
>
>  <publications>
>    <artifact name="yourapp" type="war" conf="runtime" />
>    <artifact name="yourapp" type="ear" conf="runtime" />
>  </publications>
>
>  <dependencies>
>    <dependency org="org.apache.wicket" name="wicket" rev="1.3.5"
> conf="runtime->*">
>      <exclude org="org.apache.portals.bridges"
> module="portals-bridges-common" />
>      <exclude org="javax.portlet" module="portlet-api" />
>    </dependency>
>    <dependency org="org.slf4j" name="slf4j-log4j12" rev="1.5.6"
> conf="runtime->*" />
>    <dependency org="javax.servlet" name="servlet-api" rev="2.3"
> conf="compile->*" />
>  </dependencies>
> </ivy-module>
>
> You'll notice that I introduced a couple configurations. One is runtime. The
> other is compile, which extends runtime. Then for each dependency, I apply a
> configuration. Each configuration is picking up all configurations provided
> by the dependency module; that's the ->*.
>
> I notice you don't have a publications section, so I added the makings of
> one. Also, that filtering out of Wicket dependencies is something I would
> put in the original ivy.xml for org.apache.wicket/wicket/1.3.5, rather than
> directly in here. You can control that by specifying a configuration in that
> file and then making the dependency conf here extend that configuration.
>
> Hope that makes sense.
>
> On Sun, Jan 11, 2009 at 2:02 PM, Kent Larsson <kent.larsson@gmail.com>wrote:
>
>> Hi. I'm new to Ivy and desperately need some help. :-)
>>
>> I have this Ivy.xml:
>>
>> <ivy-module version="2.0">
>>    <info organisation="domain.organisation" module="webproject"/>
>>    <dependencies>
>>        <dependency org="org.apache.wicket" name="wicket" rev="1.3.5">
>>            <exclude org="org.apache.portals.bridges"
>> module="portals-bridges-common"/>
>>            <exclude org="javax.portlet" module="portlet-api"/>
>>        </dependency>
>>        <dependency org="org.slf4j" name="slf4j-log4j12" rev="1.5.6"/>
>>        <dependency org="javax.servlet" name="servlet-api" rev="2.3"/>
>>    </dependencies>
>> </ivy-module>
>>
>> This gives me the following JAR files in lib/
>>
>> log4j-1.2.14.jar     slf4j-api-1.5.6.jar      wicket-1.3.5.jar
>> servlet-api-2.3.jar  slf4j-log4j12-1.5.6.jar
>>
>> I want to include all of these JAR files EXCEPT one in the .war file.
>> The file I do not want to include is servlet-api-2.3.jar as it's only
>> a compile time dependency. It will be provided by Tomcat in my case.
>>
>> How would you cleanly separate these? After <ivy:retrieve sync="true"
>> /> I have all the dependencies in lib/ .
>>
>> What is the nicest way to exclude this one JAR-file? Should I just
>> hard code it in my Ant script? Has Ivy some nice feature for this? I'm
>> new to Ivy, I have looked around but haven't found any example I can
>> apply.
>>
>> Best regards, Kent
>>
>

Mime
View raw message