I have some third party plugins that are not available publicly. I would like to create a local repository so that me and my co-workers can install these plugins easily. I have a server that already has nginx installed. So I'd like to use that if possible. That is, I'm not keen on installing another web server like Tomcat to run something like the grails.org web interface (as the documentation suggests in " Your own plugin portal ").
Based on the grailsRepo() function and getPluginList() , I have created a "grails" directory on my web server like so:
/grails
- /.plugin-meta
- /plugins-list.xml
- /grails-my-plugin
- /tags
- /RELEASE_1_0_123
- /grails-my-plugin-1.0.123.zip
Where the plugin is named "my-plugin" and the version number of the plugin is 1.0.123.
My plugins-list.xml is like so:
<plugins revision="1">
<plugin latest-release="1.0.123" name="my-plugin">
<release tag="RELEASE_1_0_123" type="svn" version="1.0.123">
<title>MyPlugin</title>
<author>No Author</author>
<authoremail>no@email</authoremail>
<description>An example plugin.</description>
<file>http://mydev.example.com/grails/grails-my-plugin/tags/RELEASE_1_0_123/grails-my-plugin-1.0.123.zip</file>
</release>
</plugin>
</plugins>
With the repository configured as detailed, I created a new Grails application ( grails create-app test-app
) and adjusted the grails-app/conf/BuildConfig.groovy
to include the following configuration:
repositories {
grailsRepo("http://mydev.example.com/grails", "myDevRepo")
}
Whenever I attempt to install the "my-plugin" plugin to this Grails app I see a request on my web server, and Grails reports that it attempted to download from my repository like so:
==== myDevRepo: tried
-- artifact org.grails.plugins#my-plugin;latest.integration!my-plugin.zip:
http://mydev.example.com/grails/grails-my-plugin/tags/LATEST_RELEASE/grails-my-plugin-[revision].zip
It seems to me that Grails is not attempting to read the .plugin-meta/plugins-list.xml
file I have created for my repository. What do I need to do to make this repository work with minimal configuration of the local Grails app?
Note: I am using Grails 1.3.7.
cdeszaq from #grails on irc.freenode.org led me to the following solution:
Forget about using the "grailsRepo" type repository layout. It's woefully undocumented and clearly doesn't work well. Instead, use the Maven repository layout .
Let's assume you have a plugin named "foo" at version 1.0.5 and it is packaged into a zip file named "foo-1.0.5.zip". To create an HTTP based repository we do the following:
First, create a directory structure on your web server:
/grails-maven
-/org
-/grails
-/plugins
-/foo
-/1.0.5
Place your "foo-1.0.5.zip" file, along with an MD5 sum file ( md5sum -b foo-1.0.5.zip > foo-1.0.5.zip.md5
), into the deepest directory of this tree. Thus, you'll have the following URLs:
http://example.com/grails-maven/org/grails/plugins/foo/1.0.5/foo-1.0.5.zip
http://example.com/grails-maven/org/grails/plugins/foo/1.0.5/foo-1.0.5.zip.md5
Enable directory indexing output for the grails-maven
directory in your web server configuration. In the case of nginx, the following configuration will work:
server {
location ^~ /grails-maven {
autoindex on;
}
}
Finally, enable the repository in your Grails app's BuildConfig.groovy
:
repositories {
mavenRepo("http://example.com/grails-maven/")
}
Having completed the above, you can now grails install-plugin foo
and get the plugin installed into your Grails app.
Not a real answer to your quest, bit it might help...
we don't use a servre as internal repository, but a flat folder which we distribute through svn.
this works great if you just specify your repository as
repositories {
flatDir name:'myRepo', dirs:'/path/to/repo'
}
but it seems that a grails list-plugin
will not work. Grails 1.3.7 even seems not to try to resolve the plugins-list.xml file.
if you drop your plugins as zip file named [plugin]-[version].zip
and [grails]-[plugin]-[version].zip
, grails will pick up the latest version when you do a
grails install-plugin [plugin]
you don't have to specify the full path this way. Don't ask me why I drop two copies - it just works for me :-(
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.