I'm pretty new to IVY. I'm trying to do the following:
I wanted to add http://mvnrepository.com to the repository list. I'm not sure if I have to define the correct pattern based on how it is defined under mvnrepository.
Also I want a specific library to be downloaded from there instead of from another repository.
This is my ivysettings file:
<ivysettings>
<properties file="build.properties" />
<settings defaultResolver="local-chain"/>
<resolvers>
<ibiblio name="ibiblio-maven2" m2compatible="true"/>
<ibiblio name="java-net-maven2" root="http://download.java.net/maven/2/" m2compatible="true" />
<ibiblio name="maven" root="http://mvnrepository.com/artifact/" m2compatible="true" />
<filesystem name="project-built" checksums="">
<ivy pattern="${repository.dir}/[module]-ivy.xml" />
<artifact pattern="${repository.dir}/[artifact].[ext]" />
</filesystem>
<chain name="local-chain">
<resolver ref="maven"/>
<resolver ref="ibiblio-maven2"/>
<resolver ref="java-net-maven2"/>
<resolver ref="project-built"/>
</chain>
</resolvers>
And this is my ivy file:
<ivy-module version="1.0">
<info organisation="project" module="com.project.test.framework" />
<dependencies>
<dependency org="commons-collections" name="commons-collections" rev="3.2"/>
<dependency org="commons-configuration" name="commons-configuration" rev="1.6"/>
<dependency org="commons-lang" name="commons-lang" rev="2.6"/>
<dependency org="commons-logging" name="commons-logging" rev="1.1"/>
<dependency org="junit" name="junit" rev="4.8"/>
<dependency org="org.seleniumhq.selenium" name="selenium" rev="2.0rc2"/>
<dependency org="net.sf.json-lib" name="json-lib" rev="2.4" conf="default->compile"/>
<dependency org="com.sun.jersey" name="jersey-core" rev="1.8" conf="default->compile"/>
<dependency org="com.sun.jersey" name="jersey-client" rev="1.8" conf="default->compile"/>
</dependencies>
Basically I want JSON to be downloaded from MAVEN mvnrepository. I thought that when I put maven into the first place it will get it from there and that's that. But it doesn't seem to be using mvnrep at all.
I do think it's configured the wrong way.. But I'm not sure how to do it right.
I did read a lot of posts about it, and I still don't feel that I know the solution.
Thanks for any kind of help!!
To force specific resolver for a module use something like this in your ivysettings.xml:
<ivysettings>
<properties file="build.properties" />
<settings defaultResolver="local-chain"/>
<resolvers>
<ibiblio name="ibiblio-maven2" m2compatible="true"/>
<ibiblio name="java-net-maven2" root="http://download.java.net/maven/2/" m2compatible="true" />
<ibiblio name="maven" root="http://mvnrepository.com/artifact/" m2compatible="true" />
<filesystem name="project-built" checksums="">
<ivy pattern="${repository.dir}/[module]-ivy.xml" />
<artifact pattern="${repository.dir}/[artifact].[ext]" />
</filesystem>
<chain name="local-chain">
<resolver ref="maven"/>
<resolver ref="ibiblio-maven2"/>
<resolver ref="java-net-maven2"/>
<resolver ref="project-built"/>
</chain>
</resolvers>
<modules>
<module organisation="json" resolver="maven"/>
</modules>
</ivysettings>
See the documentation for details.
Perhaps you are missing the returnFirst="true" attribute from your chain.
Related
I have netcore 3.1 Console application with a Package Reference and a Project Reference.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<PackageId>MyPackageId</PackageId>
<Product>MyProduct</Product>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<AssemblyName>MyAssemblyName</AssemblyName>
<Version>1.0.1</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Mono.Options" Version="6.6.0.161" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\MyUtilityProject.csproj" />
</ItemGroup>
</Project>
I would expect the pack function to reference the compiled dll's from MyUtilityProject, but instead it looks up the version from MyUtilityProject.csproj and converts it into a package reference.
Here is the generated .nuspec file:
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>MyPackageId</id>
<version>1.0.1</version>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<dependencies>
<group targetFramework=".NETCoreApp3.1">
<dependency id="MyUtilityProject" version="2.13.0" exclude="Build,Analyzers" />
<dependency id="Mono.Options" version="6.6.0.161" exclude="Build,Analyzers" />
</group>
</dependencies>
</metadata>
<files>
<file src=".\MyProduct\bin\Debug\netcoreapp3.1\MyProduct.runtimeconfig.json" target="lib\netcoreapp3.1\MyProduct.runtimeconfig.json" />
<file src=".\MyProduct\bin\Debug\netcoreapp3.1\MyProduct.dll" target="lib\netcoreapp3.1\MyProduct.dll" />
</files>
</package>
How do I convince the VS build job, that it should include the dll's and not reference the package?
The resolution to my problem was adding
<PackAsTool>true</PackAsTool>
to the project file.
I guess it was not quite clear from my question, that I was trying to build a tool, except for the fact that OutputType is exe.
This leads to the conclusion, that MicroSoft assumes that if you push a packet, all referenced projects are also pushed as packages.
I use visual studio 2015 and when I want to use a nuget package(includes .netcore and .net versions both) from my .net45 project that time nuget package manager try to resolve .netcore depencies and failed.What I am waiting if my project is .net45 that time only try to resolve target framework 4.5 depencies but nuget try to resolve .NETStandard1.3 dependecies too. Am I missing something or is this design behaviour of nuget?
nuspec file like that
<dependencies>
<group targetFramework=".NETFramework4.5">
<dependency id="librdkafka.redist" version="0.11.0" exclude="Build,Analyzers" />
</group>
<group targetFramework=".NETFramework4.6">
<dependency id="librdkafka.redist" version="0.11.0" exclude="Build,Analyzers" />
</group>
<group targetFramework=".NETStandard1.3">
<dependency id="NETStandard.Library" version="1.6.1" exclude="Build,Analyzers" />
<dependency id="librdkafka.redist" version="0.11.0" exclude="Build,Analyzers" />
<dependency id="System.Console" version="4.3.0" exclude="Build,Analyzers" />
<dependency id="System.Linq" version="4.3.0" exclude="Build,Analyzers" />
<dependency id="System.Runtime.InteropServices" version="4.3.0" exclude="Build,Analyzers" />
<dependency id="System.Runtime.Extensions" version="4.3.0" exclude="Build,Analyzers" />
<dependency id="System.Threading" version="4.3.0" exclude="Build,Analyzers" />
</group>
</dependencies>
nuget vs2015 Cannot Resolve Group Target Dependicies Correctly
According to the troubleshooting on above comments, you need update your nuget extensions after the 2.12 version. That because starting with nuget 2.12, nuget support full NetStandard and NetCoreApp. You can refer to the nuget release note for 2.12:
•Full NetStandard and NetCoreApp support for VS2013
So, to resolve this issue, please update your nuget extensions first.
I'm trying to understanding and using ivy with archiva, but i have this strange thing that i can't explain,
Build.xml
...some xml code
<target name="resolveArchiva" description="--> go take the jar">
<ivy:settings file="./archivaIvySetting.xml" >
<credentials host="my host to Archiva" realm="my repository's name"
username="user" passwd="passwd"/>
</ ivy:settings>
<ivy:retrieve />
</target>
some other code....
Ivy.xml
<ivy-module version="2.0">
<info organisation="archiva" module="my-repo"/>
<dependencies>
<dependency org="annogen" name="annogen" rev="0.1.0"/>
<dependency org="commons-lang" name="commons-lang" rev="2.1" />
</dependencies>
</ivy-module>
arvchivaIvySetting.xml
<ivysettings>
<settings defaultResolver="archiva" />
<resolvers>
<ibiblio name="archiva" m2compatible="true" root="repositories/internal/"/>
</resolvers>
</ivysettings>
the problem it's that in my repo there is an artifact for annogen but it's not present the common-lang artifact, despite that, the build says that it find the artifacts for both the dependencies, and that's true because i find both .jar in my lib project. How is it possible? it's clear that my setting doesn't point to the archiva rep but to the maven ones but how can i change it?
I have add resolver to ivysettings.xml
<ibiblio name="google-api-services" root="http://mavenrepo.google-api-java-client.googlecode.com/hg" m2compatible="true" />
But get a error
module not found: com.google.apis#google-api-services-drive;v2-rev13-1.8.0-beta
It resolves fine for me..... Perhaps there is a problem with your ivysettings file?
The following example configures the google api services repo and Maven Central.
<ivysettings>
<settings defaultResolver="repos" />
<resolvers>
<chain name="repos">
<ibiblio name="central" m2compatible="true"/>
<ibiblio name="google-api-services" m2compatible="true" root="http://mavenrepo.google-api-java-client.googlecode.com/hg"/>
</chain>
</resolvers>
</ivysettings>
I have a <filesystem> resolver in my ivysettings.xml, along with the central M2 repository, and it all works OK. However, I was wondering whether there is a way to bypass the cache entirely for the dependencies found with the filesystem resolver. I don't need to have them so many times around on my filesystem (once in the directory searched by the resolver, once in the cache, and once in each project's lib folder…).
Found it. The name of a cache with the useOrigin="true" attribute can be specified on the resolver:
<ivysettings>
<settings defaultResolver="main"/>
<caches>
<cache name="main" basedir="${ivy.settings.dir}/ivycache" />
<cache name="nocache" useOrigin="true" />
</caches>
<resolvers>
<chain name="main">
<filesystem name="filesystem" cache="nocache">
<artifact pattern="${ivy.settings.dir}/ivyrep/[artifact].[ext]" />
</filesystem>
<ibiblio name="ibiblio" m2compatible="true" usepoms="false" />
</chain>
</resolvers>
</ivysettings>