How to publish libraries from Ivy cache to artifactory Ivy repos - ivy

We lost our ivy repository for 3rd party libraries (a lot of them). The only thing we have is the ivy cache sitting on a build agent. Now we decide to move to Artifactory, ivy:install can copy dependencies from a repo to another, but ivy cache is not a repo. In addition, the ivy cache keeps all versions of a jar file under the same directory (ivy cache default pattern) - [organization]/[module]/[type]s/ (no revision). But we'd like to sort them out into different directories - [organization]/[module]/[revision]/[type]s/.
After doing this, should the new repo in artifactory function the same as any other repository? In other words, do I miss anything by creating a repository in this way?
Any help is greatly appreciated.

You can create a new repository layout in Artifactory that will match the Ivy cache layout:
[org]/[module]/[type]s/[module](-[classifier])-[baseRev](-[fileItegRev]).[ext]
Then create a new local repository configured with the Ivy cache layout and import the content of your Ivy cache into the new local repository.
Finally create a new virtual repository configured with the default Ivy layout and include the local repository you created. The virtual repository will perform the transformation between the Ivy cache layout and the Ivy default layout. You will need to configure Ivy to resolve artifacts from the virtual repository. In addition you will be able to include other Ivy repositories in this virtual.

Related

Create a Private Remote Ivy Repository

I've been doing quite a bit of searching and am unable to put all the pieces together. I want to create an ivy repository on one of our servers. I want to lock it down so it is private, and then be able to publish to this repository from Gradle.
I know how to publish using Gradle, and I have that working with a local ivy file system that Gradle creates:
repositories {
mavenCentral()
ivy {
name "localRepos"
url "${System.properties['user.home']}/repos"
}
}
uploadArchives {
repositories {
add project.repositories.localRepos
}
}
So what I need to do now is translate that into publishing to a remote private repos. But first, obviously, I need to create that repos and I can't seem to figure that out from the Ivy documentation or Google searching. Can someone point me in the right direction?
I'd prefer not to have to go down the Nexus, etc approach (no Maven).
An Ivy repository is just a file store, and hence you need to set up a server (e.g. Apache httpd) that allows to read and write those files (e.g. via HTTP GET/PUT). However, I strongly recommend to use a repository manager. Artifactory is a good choice.

Maven tries to download dependency despite it existing in local repository

I have an installed dependency in my local repository. The remote repository where the dependency came from is now down for some reason. When I try to compile the project Maven says that it can't resolve dependency. But why???
When you have these error, simply clean the _remote.repositories that indicate maven where the dependency comes from. You will find this file for each artifact inside your M2_REPO.
Maven will compare the local POM's timestamp (stored in a repository's maven-metadata file) to the remote. When maven does this depends on the updatePolicy that can be defined in your settings xml.
Either set this to never (discouraged) or skip this check (only when a remote repository appears to be down) by using the -o option (offline); then maven will not check remote repositories.

How to deploy jar artifacts directly from a maven repository to appserver specific directories

I have JDBC driver dependencies (e.g. h2, mysql ..) which have to be copied under ${jboss.home}/common/lib before it is used by my EAR application. What would be the best way to directly copy from a maven repository into the above location instead of doing a manual copy. I would not prefer to store copies of the drivers as part of my SVN.
Note: I currently specify this as a maven dependency and copy this artifact from the local repository, not sure if this is the best way to do solve this.
One way to do this would be to use the Maven Dependency Plugin and its dependency:copy goal that allows to copy a list of artifacts from the repository to defined locations. See the Copying specific artifacts example.

How can I get nexus to proxy springsource maven repository on s3?

I have nexus 1.5.0 setup to proxy springsource repositories but it's not working. The repositories are on s3 that nexus doesn't seem to understand how to deal with that.
What's the right pattern?
Here are the repositories I'm told I need, but I cannot access the maven paths with in them
http://repository.springsource.com/maven/bundles/release
http://repository.springsource.com/maven/bundles/external
Do, I need to mirror these locally?
According to NEXUS-1121, your version of Nexus knows how to deal with S3 based repositories. Below, Eugene's comment:
Here is Nexus setup that works for me:
Configured "proxy" repository for http://repository.springsource.com/maven/bundles/release
Configured "proxy" repository for http://repository.springsource.com/maven/bundles/external
Added both of those repositories into default "Public Repositories" group
After that I am able to download
artifacts from those repositories as
if they are in Maven Central
repository.
The only issue is that you can only
search trough artifacts that been
proxied, because there is no Nexus
index published on those repositories.
It should be easy to publish index and
instructions for using standalone
indexer can be found at
http://docs.codehaus.org/display/M2ECLIPSE/Nexus+Indexer#NexusIndexer-indexer
It works for me with this configuration and with another repository.
I have a Sonatype Nexus repository version 1.9.1.1. I wanted to configure the repositories to download artifacts from http://maven.springframework.org/milestone/.
I have created a new proxy repository with this configuration:
id: repository.springframework.maven.milestone
Name: Spring Maven Milestone Repository
Rep. Type: proxy
Provider: Maven2
Format: Maven2
Rep Policy: Release
Remote storage: http://maven.springframework.org/milestone/
Down. Remote indexes: false
Auto blocking: true
File validation: False
Checksum: warm.
I saved the data and the repository was created.
The strange thing is that when i try to use the "browse Remote" tab I can't list anything.
Important: After that I clicked on Public Repositories / Configuration and added the Spring Maven Milestone Repository to the ordered group repositories.
And finally, I wrote the dependency in my POM archive:
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>1.0.0.RC1</version>
</dependency>
And it was downloaded without problems.
I hope it will be useful.

How do I set up the JBoss Maven repository in NetBeans 6.5?

I tried to configure the Maven plug in (version 4) to add the JBoss Maven repository at http://repository.jboss.com/maven2/ following the guide at http://wiki.netbeans.org/MavenBestPractices#section-MavenBestPractices-UtilizingAndManagingMavenRepositories.
The new repository appears in the list of Maven repositories, but I can not see any items (artifacts), updating the index does not help.
It looks like a problem with the Maven plug in. Maybe it requires an ".index" subdirectory which is not available on the JBoss server.
The JBoss repository has a Nexus index at http://repository.jboss.com/maven2/.index/. I think the problem is that Netbeans might not be making use of this index. I would recommend installing Nexus, adding the JBoss repo to a public group and then pointing your Netbeans instance at a local instance of Nexus.
Download Nexus from http://nexus.sonatype.org
Install it by unpacking the tar.gz or zip on your machine
Fire it up by running bin/jsw//nexus start
Go to http://localhost:8081/nexus
Log in as the default admin user: admin/admin123 is the username/password
Click on Repositories
Click the Add... button
Add a new repository for the JBoss repositorywith a remote location of: http://repository.jboss.com/maven2/
Save the new repository. (You will also want to make sure that Download remote index is selected)
Add the repository to your public group by clicking on the public group and dragging the new JBoss repository to the selected repositories.
Configure your ~/.m2/settings.xml file to have the same contents as: http://www.sonatype.com/books/nexus-book/reference/maven-sect-single-group.html
At that point, all of your repository requests are going to flow through Nexus. Nexus already ships with proxy repositories for Central. So all you did was to add in the JBoss repository and then add it to the public group. Once you do this, you'll find that your builds are going to be much, much faster.