Resolving snapshot versions of Grails plugins (deployed using the maven-publisher plugin) - grails

Good day,
I'm trying to integrate our company's Grails plugins into our Maven repositories (our repositories are named 'snapshots' and 'releases').
To do that, I installed the maven-publisher plugin in all of our plugins, and I'm deploying them using the "grails maven-deploy" command. This works well.
However, if I deploy a SNAPSHOT version of a plugin (say, version 1.0.0-SNAPSHOT), it gets properly deployed in our repository, but I can't install it in our applications (using version "latest.integration").
I'm using Grails 1.3.7.
First of all, when deployed, the actual artifact name has a timestamp added to it ("blablabla-1.0.0-20110421.122823-1.zip"). However, the version is still 1.0.0-SNAPSHOT. I'm guessing that it's Maven that does that transformation.
However, Ivy doesn't seem to understand the transformation, or to handle SNAPSHOT versions. I get errors like:
==== http://myRepo/repository/snapshots: tried
-- artifact myOrg#blablabla;latest.integration!blablabla.zip:
http://myRepo/repository/snapshots/myOrg/blablabla/[revision]/blablabla-[revision].zip
Initial research has revealed that I could create a resolver pattern, but that seems a little bit complicated for something that should work out of the box, and my initial tests were not conclusive anyway (I tried a few patterns, none of which worked).
I should note that deploying my plugins locally using the "maven-install" command works, because the script create an artifact with the proper version (blablabla-1.0.0-SNAPSHOT.zip) alongside the one with timestamps.
Does anybody have a solution?
Thanks!
Guillaume.

I resolved this modifying Artifactory snapshot repository configuration:
<snapshotVersionBehavior>non-unique</snapshotVersionBehavior>
Now when you have foo-plugin-1.0-SNAPSHOT.zip and you upload it the name stays same.

Related

Jenkins plugin updates are unavailable

I have updated my jenkins server and see the following message for some plugins. I am not sure how to fix this. I looked at the dependencies section for that plugin and I see they are already installed. Not sure what else is missing so I can see the update available. Dependency for this is Mailer which is already installed on my server.
That is frustrating but you can try uploading plugins manually.
You can download plugins from here link to plugin storage.
Of course you have to roughly see what version of the plugin goes with your jenkins version.
Once you downloaded 'proper' plugin version, you go to manage plugins, advanced tab and there you can upload the plugin file. After that restart jenkins and check changes. You should really go to manage plugins, updated plugin tab and update selected plugins...
It could be guess work, but I'm sure after a couple of guesses you'll get to the version of Jenkins you have.
You might need to upgrade jenkins.. here are all jenkins war files:
https://get.jenkins.io/war-stable/
Last but not least... don't try to fix all dependencies.. fix those you use, rest is optional.

What is difference between .hpi and .jpi of Jenkins plugins?

I have installed Jenkins plugins in two ways i.e. manually keeping the .hpi file in Jenkins home directory, and installing from Jenkins front-end (Manage Jenkins > Manage Plugins).
What I notice here is when I install the plugin manually (downloaded as .hpi file) it installed with extension .hpi and while installing the plugin through Jenkins front-end I notice that plugin again installed as .jpi.
But why? What is going on in the background? I know functionality won't change but it looks interesting to know.
Both are supposed to be identical to that extend that Jenkins is renaming hpi to jpi when you install it manually as you said.
The reason why you see both in your JENKINS_HOME is the order in which plugins are loaded when Jenkins boots up: plugin.jpi gets precedence over plugin.hpi in case both are present. This is the way the upload installation makes sure the uploaded version will override the existing one after the restart.
Well I think its because Jenkins forked from Hudson so that is the 'H' in hpi. The J is obviously a change to that.
In terms of technology, the jpi plugins are generated using the gradle plugin architecture and hpi plugins are generated with the Maven architecture
Ultimately, as you have found both produce plugins which Jenkins can use. The vast majority are built using Maven but I am a fan of Gradle as it links nicely in with developing plugins in Groovy. You can also build in Groovy using Maven
Plugins as present in $JENKINS_HOME/plugins/ should always be using the .jpi suffix (with the basename being the plugin identifier). Normally Jenkins will enforce this naming pattern even when uploading a plugin manually, regardless of what filename you used for the upload, so I am not sure how you came to have a *.hpi file here, unless you directly copied it into this filesystem location.

Grails Dependency Resolution Issue

I'm having a problem on my machine where a specific dependency is not being resolved causing a ClassNotFoundException at runtime. Running grails dependency-report on my machine shows the artifact in question as having no dependencies, while on another developer's machine it shows dependencies properly.
Why would grails on my machine think the artifact has no dependencies, yet on another developer's machine the dependencies are correctly shown?
All other dependencies are resolved. Just this one artifact is not having its dependencies resolved on my machine.
Environment: Grails 1.3.7, Java 1.6.0_29
Problem solved. It had to do with our local Artifactory having a bad pom. Our artifactory is actually composed of multiple repositories that are exposed as one virtual repository. The artifact in question was contained in two of those repos. One of the repos had a pom showing no dependencies for the artifact. This repo took precedence in the "virtual" view. We removed the corrupted version and then things started working.
How/why our Artifactory got this pom is still a mystery. But somehow it happened between the time my co-worker built out their environment and when I built out mine.

Grails: working offline with snapshot dependencies

I am using some plugins which depend on snapshot versions of other plugins.
As I understand, Ivy tries to fetch the newest version of these plugins every time you start grails. If Ivy does not succeed, grails will not start :-(
As I like to develop offline, I am now looking for a way which lets me avoid this behaviour...
You could pull them down and store them on your machine using a local repository and comment out any remote repositories. Here is some documentation. Scroll down to "local resolvers"

Effective grails plugin development

This has been very upsetting for me up till now. Here is what I am trying to do:
IDE I'm using is Intellij IDEA.
Building a grails application.
Grails application specifies two dependencies on in house grails plugins also being developed in IntelliJ as separate grails plugin projects.
Now to make any changes to plugins, I update the source code in plugin projects and use mavan-install (Maven Publisher plugin) to deploy to local Maven repository.
I have to uninstall the plugin in core grails project. Delete the plugin cache from ivy and then run the core grails project which gets the latest copy of plugin from local maven repository.
What's the effective and ideal way to achieve this? A single change makes me do some 5 minutes of labour work to even test and run core application.
Any recommendations/ best practices?
Use inline plugins for this - see section "Specifying Plugin Locations" in http://grails.org/doc/latest/guide/12.%20Plug-ins.html#12.1%20Creating%20and%20Installing%20Plug-ins
By specifying the plugin project directory with grails.plugin.location.<plugin-name> as the location of the installed plugin, you can edit the real files and the changes will affect the test application, and there's no need to sync anything up.

Resources