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 ?