Ivysettings.xml: Can I "change" the default settings without changing the bank or completely replacing them?

I am looking through the Ivy documentation and I have a question about the standard ivysettings.xml found inside ivy.jar.

All I want to do is change the public repository to the local Maven repository that we have. It. I could copy all the ivysettings*.xml into my project and use <ivy:settings> to point to it, but this duplicates a lot of things. I could also change ivy.jar , but that adds maintenance headaches. Developers should use my ivy.jar , and if we switch to the new version, I will have to change it again.

So, how do I save all the standard Ivy settings and just switch the storage to use? I just want to apply my changes to what Ivy already has.


And two more questions:

  • What is the difference between ivyconf*.xml and ivysettings*.xml ? Why are there duplicate configurations in Ivy?
  • What is a good book about Ivy? I am currently using Manning Ant in action, which covers Ivy in a somewhat concise way and is a bit outdated. The resources on the Ivy website itself are terrible.
+7
source share
3 answers

I finally understood.

I copied the ivysettings.xml file from the jar and made a small modification. Note that the former include dots in the XML file in ivy ${ivy.lib.dir} , and not in ${ivy.default.settings.dir} :

 <ivysettings> <settings defaultResolver="default"/> <include file="${ivy.lib.dir}/ivysettings-public.xml"/> <include url="${ivy.default.settings.dir}/ivysettings-shared.xml"/> <include url="${ivy.default.settings.dir}/ivysettings-local.xml"/> <include url="${ivy.default.settings.dir}/ivysettings-main-chain.xml"/> <include url="${ivy.default.settings.dir}/ivysettings-default-chain.xml"/> </ivysettings> 

I have my own ivysettings-public.xml , which is the same as the default, but now defines root in my repository. (Yes, now this is a local host, but I will install it on the actual server, as soon as everything works out):

 <ivysettings> <resolvers> <ibiblio name="public" m2compatible="true" root="http://localhost:8081/artifactory/repo" /> </resolvers> </ivysettings> 

Now, in my build.xml , I have the following:

 <property name="ivy.lib.dir" value="${basedir}/ivy.lib"/> <taskdef uri="ivylib:org.apache.ivy.ant" resource="org/apache/ivy/ant/antlib.xml"> <classpath> <fileset dir="${ivy.lib.dir}"> <include name="ivy.jar"/> <include name="ivy-*.jar"/> </fileset> </classpath> </taskdef> <ivy:configure file="${ivy.lib.dir}/ivysettings.xml" override="true"/> 

This seems like a trick.

+1
source

What is my ivysettings.xml file

 <ivysettings> <include url="${ivy.default.settings.dir}/ivysettings.xml"/> <resolvers> <chain name="download-chain" changingPattern=".*" checkmodified="true" > <ibiblio name="maven" m2compatible="true" /> </chain> </resolvers> </ivysettings> 

Please note that here I write additional receivers, but I use everything else from the standard, which is indicated in the URL. This will load the settings from the ivysettings.xml file in the ivy.jar file.

Regarding ivyconf * .xml. I think this is out of date now. Ivysettings is a new way to do this.

The resources are pretty terrible. I totally agree with that. However, the many answers at stackoverflow.com were detailed enough and actually tried to anticipate the problems.

Mark O'Connor's answers are particularly detailed and straightforward. You have to accept the fact that you are learning something new, just give it time.

+6
source

In your build.xml file, specify the following:

 <property name="ivy.settings.dir" value="PATH OF SETTINGS" /> <property file="${ivy.settings.dir}/ivysettings.properties" /> <ivy:settings file="${ivy.settings.dir}/ivysettings.xml" /> 
0
source

All Articles