You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-user@ant.apache.org by Mansour Al Akeel <ma...@gmail.com> on 2012/01/22 23:19:52 UTC

Reusing config

I do have few questions about ivy.

In maven there's ".m2/settings.xml" that will always be read by maven
when invoked. Ivy does not have this user wide config, and a file has
to be always specified using:
<ivy:settings file="path/to/ivysettings.xml" />

In other words having ~/.ivy2/ivysettings.xml will never be read every
time without using <ivy:settings /> task

Please correct me if I am wrong.

The second question is about publishing and generating the artifact.
The packaging has to be done manually using ant, then the ivy.xml resolved file
and pom file has to be added before the jar is created. Then it can be
published to a local repo. Is that right or there's a shorter way that
I missed ? If so, where should the resolved ivy.xml file be located in
the jar file ?

I am wondering if there is a way to encapsulate some ivy settings in
an ant task that will be used as antlib ?
For example, we need to always to publish to a specific resolver with
specific pattern (maven2). Can we encapsulate this configuration in an
ant task to used for all the modules ? For example, I want a custom
task, <mynamespace:install-to-maven /> that will
automatically install to maven repo without additional config in
ivysettings.xml. Is this possible ?

Re: Reusing config

Posted by Mansour Al Akeel <ma...@gmail.com>.
Thank you Rogers for taking the time to reply. I understand the
resolver and to configure it to use maven. I do publish to local maven
repo, but what I was curious about, is't possible to encapsulate some
of the default configuration in an antlib, this when users type

<install-to-maven />

We know it's going into local maven repo. For example, to avoid
getting the developer to type this all the time or having a file
containing this part, that doesn't change a lot.

  <filesystem name="maven2-local" m2compatible="true">
            <artifact

pattern="${user.home}/.m2/repository/[organisation]/[module]/[revision]/[artifact](-[classifier]).[ext]"/>
        </filesystem>

I feel it's easier just to wrap these default configurations in an ant task.

Thank you.



On Sun, Jan 22, 2012 at 8:34 PM, Roger <ro...@gmail.com> wrote:
> A key difference between maven and ivy is that ivy is normally used with
> ant, so you should expect to use ivy:settings from ant. Often I use
> different settings files in different situations so I would not want ivy to
> find just one settings file and use that all the time.
>
> The ivy.xml file does not go int the jar file, it goes into the repository
> as a separate file. The repository contains jar file(s), possibly other
> artifacts and the ivy.xml file. The publish command pushes all the artifacts
> and the ivy.xml file into the repository.
>
>
> "we need to always to publish to a specific resolver with specific pattern
> (maven2). Can we encapsulate this configuration in an ant task to used for
> all the modules?"
>
> If you define the resolver in the ivy settings file correctly you should be
> able to use the publish command to sent it
> to the repository. I'm not certain about doing this to a maven repo, but
> there are a lot of options in the settings. To handle the pom file
> you ought to use the makepom command
> (http://ant.apache.org/ivy/history/2.0.0/use/makepom.html)
>
> Although I said you have to use ant for all this there are other options
> depending on your IDE. Eclipse has a plugin that allows you to specify the
> ivysettings file per-workspace and all projects in that workspace will
> resolve using that. I've not used that approach to publish though, I prefer
> to build with ant and publish is part of my build.
>
>
> On 23/01/12 11:19, Mansour Al Akeel wrote:
>>
>> I do have few questions about ivy.
>>
>> In maven there's ".m2/settings.xml" that will always be read by maven
>> when invoked. Ivy does not have this user wide config, and a file has
>> to be always specified using:
>> <ivy:settings file="path/to/ivysettings.xml" />
>>
>> In other words having ~/.ivy2/ivysettings.xml will never be read every
>> time without using<ivy:settings />  task
>>
>> Please correct me if I am wrong.
>>
>> The second question is about publishing and generating the artifact.
>> The packaging has to be done manually using ant, then the ivy.xml resolved
>> file
>> and pom file has to be added before the jar is created. Then it can be
>> published to a local repo. Is that right or there's a shorter way that
>> I missed ? If so, where should the resolved ivy.xml file be located in
>> the jar file ?
>>
>> I am wondering if there is a way to encapsulate some ivy settings in
>> an ant task that will be used as antlib ?
>> For example, we need to always to publish to a specific resolver with
>> specific pattern (maven2). Can we encapsulate this configuration in an
>> ant task to used for all the modules ? For example, I want a custom
>> task,<mynamespace:install-to-maven />  that will
>> automatically install to maven repo without additional config in
>> ivysettings.xml. Is this possible ?
>>
>

Re: Reusing config

Posted by Roger <ro...@gmail.com>.
A key difference between maven and ivy is that ivy is normally used with 
ant, so you should expect to use ivy:settings from ant. Often I use 
different settings files in different situations so I would not want ivy 
to find just one settings file and use that all the time.

The ivy.xml file does not go int the jar file, it goes into the 
repository as a separate file. The repository contains jar file(s), 
possibly other artifacts and the ivy.xml file. The publish command 
pushes all the artifacts and the ivy.xml file into the repository.

"we need to always to publish to a specific resolver with specific 
pattern (maven2). Can we encapsulate this configuration in an ant task 
to used for all the modules?"

If you define the resolver in the ivy settings file correctly you should 
be able to use the publish command to sent it
to the repository. I'm not certain about doing this to a maven repo, but 
there are a lot of options in the settings. To handle the pom file
you ought to use the makepom command 
(http://ant.apache.org/ivy/history/2.0.0/use/makepom.html)

Although I said you have to use ant for all this there are other options 
depending on your IDE. Eclipse has a plugin that allows you to specify 
the ivysettings file per-workspace and all projects in that workspace 
will resolve using that. I've not used that approach to publish though, 
I prefer to build with ant and publish is part of my build.

On 23/01/12 11:19, Mansour Al Akeel wrote:
> I do have few questions about ivy.
>
> In maven there's ".m2/settings.xml" that will always be read by maven
> when invoked. Ivy does not have this user wide config, and a file has
> to be always specified using:
> <ivy:settings file="path/to/ivysettings.xml" />
>
> In other words having ~/.ivy2/ivysettings.xml will never be read every
> time without using<ivy:settings />  task
>
> Please correct me if I am wrong.
>
> The second question is about publishing and generating the artifact.
> The packaging has to be done manually using ant, then the ivy.xml resolved file
> and pom file has to be added before the jar is created. Then it can be
> published to a local repo. Is that right or there's a shorter way that
> I missed ? If so, where should the resolved ivy.xml file be located in
> the jar file ?
>
> I am wondering if there is a way to encapsulate some ivy settings in
> an ant task that will be used as antlib ?
> For example, we need to always to publish to a specific resolver with
> specific pattern (maven2). Can we encapsulate this configuration in an
> ant task to used for all the modules ? For example, I want a custom
> task,<mynamespace:install-to-maven />  that will
> automatically install to maven repo without additional config in
> ivysettings.xml. Is this possible ?
>