RMorrisey
RMorrisey

Reputation: 7739

How can I load grails plugins from a custom artifactory repo?

Grails 2.3.10

I have authored a Grails plugin for use within my company and installed in on the company's Artifactory repo. How can I set up another project's BuildConfig so that it checks the company's private artifactory repo when installing plugins?

Here is what I have tried:

repositories {
    ...
    grailsRepo "http://artifactory.mycompany.com/"
}

and also...

repositories {
    ...
    mavenRepo "http://artifactory.mycompany.com/"
}

Neither of these seem to have any effect. What's the correct config to change or add to the grails plugins repo?

Ideally, I would like both the custom repo and the grails central repo to be checked for plugins.

Edit:

To clarify further... I want my project configured to pull down a plugin that only exists on the company's artifactory server, not on the central Grails plugin repo.

I get the following output from grails compile:

Error |
Resolve error obtaining dependencies: Could not find artifact org.grails.plugins:cascade-validation:zip:0.1.0 in grailsCentral (http://repo.grails.org/grails/plugins) (Use --stacktrace to see the full trace)
Error |
Resolve error obtaining dependencies: Could not find artifact org.grails.plugins:cascade-validation:zip:0.1.0 in grailsCentral (http://repo.grails.org/grails/plugins) (Use --stacktrace to see the full trace)
Error |
Resolve error obtaining dependencies: Could not find artifact org.grails.plugins:cascade-validation:zip:0.1.0 in grailsCentral (http://repo.grails.org/grails/plugins) (Use --stacktrace to see the full trace)
Error |
Could not find artifact org.grails.plugins:cascade-validation:zip:0.1.0 in grailsCentral (http://repo.grails.org/grails/plugins)

It looks like the company server is not being accessed based on the build output.

Upvotes: 0

Views: 3432

Answers (1)

Ken
Ken

Reputation: 685

Here's how I do it. The plugin's BuildConfig.groovy:

grails.project.dependency.distribution = {
    remoteRepository(id: "localPluginReleases", url: "http://localhost:8081/artifactory/plugins-release-local/")
    remoteRepository(id: "localPluginSnapshots", url: "http://localhost:8081/artifactory/plugins-snapshot-local/")
}

The plugin is then packaged with:

grails publish-plugin --allow-overwrite --noScm --repository=localPluginReleases

The app's BuildConfig.groovy:

grails.project.dependency.resolution = {
    repositories {
        mavenRepo "http://localhost:8081/artifactory/plugins-snapshot-local/"
        mavenRepo "http://localhost:8081/artifactory/plugins-release-local/"
        //  other stuff
    }
}

Upvotes: 6

Related Questions