In ivy.xml
<dependency org="abc" name="validation" rev="1.0.+" changing="true" force="false" conf="build->default"/>
in ivy settings:
<chain name="hub-default-chain" returnFirst="true">
<resolver ref="view-local"/>
<resolver ref="hub-releases"/>
</chain>
It resolves from hub-releases 1.0.25 but does not resolve 1.0.22 from view-local if nothing is present in hub-releases.I can not understand why it resolves in one repository but not in other.Please help.
Error:
module not found: abc#validation;1.0.+
[ivy:cachepath] ==== view-local: tried
[ivy:cachepath] completepath\view- local\abc\validation\ivy.xml
[ivy:cachepath] [working#view-local]
[ivy:cachepath] -- artifact abc#validation;1.0.+!validation.jar:
PS: view-local is a filesystem resolver and hub-releases is a url resolver.
This is my filesystem reolver
<filesystem name="view-local"
cache="view-local-cache"
validate="true"
local="${ivy.view-local.default.local}"
checksums=""
transactional="false"
checkmodified="true"
changingPattern="view-local">
<ivy pattern="${ivy.view-local.default.repository.root}/${ivy.view-local.default.ivy.pattern}" />
<artifact pattern="${ivy.view-local.default.repository.root}/${ivy.view-local.default.artifact.pattern}" />
</filesystem>
I suspect your issue may be twofold.
First of all you are enabling the "returnFirst" parameter which would tell the chain resolver to favour one repo over the other:
http://ant.apache.org/ivy/history/latest-milestone/resolver/chain.html
Secondly I think you need to purge your ivy cache if you are changing the content of the repositories between resolve operations.
http://ant.apache.org/ivy/history/latest-milestone/use/cleancache.html
The cache would keep a record of previous resolves in order to optimize network operations.
Related
I've set up a pipeline on TFS 16.131.28601.4. When it gets to the dotnet restore task it tries to pull a package from an internal feed, which is defined in the nuget.config along with the packageSourceCredentials.
The error I get when it fails to pull the package is:
Restoring packages for .NETCoreApp,Version=v3.1...
Retrying 'FindPackagesByIdAsyncCore' for source 'http://xx.xxx.x.xx:8080/tfs/PVS/_packaging/xxx/nuget/v2/FindPackagesById()?id='xxx.Api.Client'&semVerLevel=2.0.0'.
The data is invalid.
Retrying 'FindPackagesByIdAsyncCore' for source 'http://xx.xxx.x.xx:8080/tfs/PVS/_packaging/xxx/nuget/v2/FindPackagesById()?id='xxx.Api.Client'&semVerLevel=2.0.0'.
The data is invalid.
1>C:\Program Files\dotnet\sdk\3.1.301\NuGet.targets(128,5): error : Failed to retrieve information about 'xxx.Api.Client' from remote source 'http://xx.xxx.x.xx:8080/tfs/PVS/_packaging/xxx/nuget/v2/FindPackagesById()?id='xxx.Api.Client'&semVerLevel=2.0.0'. [D:\Build\agent\_work\5\s\xxx.Api.Client.Tests\xxx.Api.Client.Tests.csproj]
C:\Program Files\dotnet\sdk\3.1.301\NuGet.targets(128,5): error : The data is invalid. [D:\Build\agent\_work\5\s\xxx.Api.Client.Tests\xxx.Api.Client.Tests.csproj]
NuGet.Protocol.Core.Types.FatalProtocolException: Failed to retrieve information about 'xxx.Api.Client' from remote source 'http://xx.xxx.x.xx:8080/tfs/PVS/_packaging/xxx/nuget/v2/FindPackagesById()?id='xxx.Api.Client'&semVerLevel=2.0.0'.
---> Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException: The data is invalid.
The nuget.config looks like this:
<configuration>
<packageSources>
<!--To inherit the global NuGet package sources remove the <clear /> line below -->
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="xxx" value="http://xx.xxx.xx.xx:8080/tfs/PVS/_packaging/xxx/nuget/v2" />
</packageSources>
<packageSourceCredentials>
<xxx>
<add key="Username" value="xxxx" />
<add key="Password" value="xxxxxxxxxxxxxxxxxxxxxxxxxxxx==" />
</xxx>
</packageSourceCredentials>
</configuration>
If I add a nuget restore task it works fine by pulling from the internal feed. Where I get stumped is the "The data is invalid" error, I can't find a reference to it anywhere.
Thanks for your help.
NuGet 4.8.2 and later supports the Azure Artifacts Credential Provider, which automatically acquires feed credentials when needed. We need to use the v3 endpoint of the nuget feed. For example:xxx.xx.x.xx:8080/tfs/xxx/_packaging/xxx/nuget/v3/index.json.
Please refer to this document.
We can use Azure Artifacts Credential Provider to authenticate and restore the feeds. The Azure Artifacts Credential Provider automates the acquisition of credentials needed to restore NuGet packages as part of your .NET development workflow.
I am using ant as a build tool and using Ivy for dependency management.
<dependency conf="compile->master;runtime->default" org="org.springframework" name="spring-web" rev="5.1.6.RELEASE"/>
<dependency conf="compile->master;runtime->default" org="io.projectreactor.netty" name="reactor-netty" rev="0.9.6.RELEASE"/>
Now when I give ant build it is failing to find the jar, the problem is it is attaching linux-x86_64.
It is searching for below jar
http://companyRepo:8081/nexus/content/groups/OfficialDevelopment/io/netty/netty-transport-native-epoll/4.1.48.Final/netty-transport-native-epoll-4.1.48.Final-linux-x86_64.jar
Why is it searching for linux-x86_64 ?
I searched and found similar issues but not sure on the solution.
https://github.com/netty/netty/issues/7101
How to build netty-transport-native-epoll-4.0.32.Final-linux-x86_64.jar?
I have no idea about ant but its basically the "classifier". Please check the ant /ivy documentation on how you can specify a classifier
I'm not an Ivy user, but I believe you need to add a dependency for netty-transport-native-epoll with a nested artifact for the classified native libraries. Something like this:
<dependency org="io.netty" name="netty-transport-native-epoll" rev="4.1.48.Final">
<artifact name="netty-transport-native-epoll"/>
<artifact name="netty-transport-native-epoll" e:classifier="linux-x86_64"/>
</dependency>
I usually use https://mvnrepository.com/ to figure out different dependency syntaxes, and the Ivy descriptors are included, but it seems that, unlike Nexus et. al., it does not support searching by classifier.
I have a project that makes use of some third-party libraries. Some of these drag in transitive dependencies that have actually several artifacts in the repository:
module-1.2.jar
module-1.2-sources.jar
module-1.2-tests.jar
My investigations tought me that these seem to be Maven build artifacts that where propagated with a classifier. Now it seems that IVY is well able to handle the sources file but when I declare a dependency like this, it appears that the wrong jar is selected:
<dependency org="acme" module="module" rev="1.2"/>
When I do a resolve in ANT like this
<ivy:resolve conf="${ivy.non.test.confs}" validate="false" refresh="true" />
<ivy:retrieve conf="${ivy.non.test.confs}" pattern="${build.lib}/[conf]/[artifact].[ext]" sync="true" />
it happens that the module-1.2-tests.jar is selected as resolve target and retrieved under the name of the actual jar name (module-1.2.jar in this example).
What am I doing wrong here?
I am trying to create a web application using MS Access as database. For it, I am using ucanaccess driver and my server is Wildfly 8.0
The issue is to how correctly configure this driver on the server ?
After researching on internet I got to know below steps
create a folder structre and place all the ucanaccess jar files-
wildfly-8.0.0.Final\modules\system\layers\base\com\ucanaccess\jdbc\main
Edit module.xml file-
<module xmlns="urn:jboss:module:1.1" name="com.ucanaccess.jdbc">
<resources>
<resource-root path="ucanaccess-2.0.9.4.jar"/>
<resource-root path="commons-lang-2.6.jar"/>
<resource-root path="commons-logging-1.1.1.jar"/>
<resource-root path="hsqldb.jar"/>
<resource-root path="jackcess-2.0.8.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
<module name="javax.servlet.api" optional="true"/>
</dependencies>
</module>
Edit standalone-full.xml file
<datasources>
<datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
<connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
<driver>h2</driver>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
</datasource>
<datasource jndi-name="java:jboss/MyDS" pool-name="MyDS" enabled="true" use-java-context="true">
<connection-url>jdbc:ucanaccess://C://Users//sahashu//Documents//NGCORE.accdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
<driver>ucanaccess-2.0.9.4.jar</driver>
<security>
<user-name></user-name>
<password></password>
</security>
</datasource>
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
<driver name="ucanaccess" module="com.ucanaccess.jdbc">
<xa-datasource-class>org.ucanaccess.jdbc.MsAccessDataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
However, still I get this error-
23:29:34,422 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 28) JBAS014613: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("jdbc-driver" => "ucanaccess")
]) - failure description: "JBAS010441: Failed to load module for driver [com.ucanaccess.jdbc]"
Please help me to identify the issue
Thanks
There is an easier way: Just create your own JAR using the UcanAccess JAR files.
In Eclipse:
Create a plain Java Project (for Java 8)
Create a dummy class with a dummy main method, and execute it (for example a simple Hello World program)
Right-click on the project -> Build Path -> Configure Build Path
Go to the Libraries tab and use "Add External JARs" to add all 5 JARs that you find in your UcanAccess download
Right-click on the project -> Export -> Java / Runnable JAR file, choose your dummy class as Launch configuration, and keep Library handling as "Extract required libraries..."
Now go to your WildFly administration console, and click on "Deployments". There you can add your freshly baked JAR and enable it. WildFly will recognize this driver automatically from now on, when you need to add a Microsoft Access Datasource using the Wizard in the administration console.
I got a strange problem. I added Guava to my ivy.xml as the following:
<dependency org="com.google.guava" name="guava" rev="14.0.1" conf="test"/>
When I run ant, I can see it's resolved:
[ivy:retrieve] found com.google.guava#guava;14.0.1 in default
And I can find the file in the ~/.ivy2/cache. But it didn't get copied to my lib directory.
Other dependencies have no problem....Any advice? Thanks.
Specify the configuration mapping in ivy.xml
I had the same problem and couldn't for the life of me figure out where the dependencies were downloaded to. Ivy seemed to suggest it was downloaded, and there were some entries in the cache, but nothing was appearing in my /lib.
---------------------------------------------------------------------
| | modules || artifacts |
| conf | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
| compile | 2 | 2 | 2 | 0 || 0 | 0 |
---------------------------------------------------------------------
But everything changed when I saw this answer.
In ivy.xml, you have to specify the configuration mapping conf="myconfig->default", the key being ->default
<configurations>
<conf name="myconfig" description="Required for JSF"/>
</configurations>
<dependencies>
<dependency conf="myconfig->default" name="jsf-api" org="com.sun.faces" rev="2.2.13"/>
</dependencies>
This will map your user-defined configuration to a Maven scope (to be exact, the default scope). In practice, you will only use either default or master scope (source).
See:
Official description: http://ant.apache.org/ivy/history/2.2.0/ivyfile/configurations.html
IMHO a clearer explanation: http://wrongnotes.blogspot.sg/2014/02/simplest-explanation-of-ivy.html
This answer discusses maven scopes other than default: https://stackoverflow.com/a/7116577/4212710
My gut feel is that this is only required if you are pointing to an Maven repository. I have not tried otherwise.
If you have already done this and it still does not download, perhaps #javabrett's answer can help.
If you truly used <ivy:retrieve />, not just resolve, then it's probably because you need to use conf="test->default" ?
This is caused by the Maven packaging-type for com.google.guava:guava:14.0.1 being the OSGi bundle rather than jar. There is an Ivy bug for this that has been resolved, but the solution is not complete.
You need to avoid specifying type="jar" and instead use type="jar,bundle" if you want to download both package-types.
See also this question and the POM definition.