I've written a Maven plugin which we're using as part of our release process - as well as the usual release basically does some extra admin. I'd like to use this plugin for releasing the plugin itself but I'm not sure this is possible.
If I include the plugin in its own POM, using ${version} as the version number then I can't release because before deploying the release build it can't find the release build in the Nexus repo. If I use an earlier version, I get a clash (I don't think Maven likes two versions of the same project at once) and I'm not having any luck using a 'provided' scope as the plugin tag doesn't support this.
Is what I'm trying to do possible or should I resign myself to having a different release procedure for the plugin itself?
Thanks,
-Dave
Related
Here I read about how to make a Groovy library .jar ... i.e. pretty much the same as making a Groovy (standalone) project. But I'm not clear what you do then with the resultant .jar...
Say I have two Eclipse "proper"/"standalone" projects (I'm using Groovy for everything) and I want them to share a third Gradle library project of mine as a dependency, which is merely a library of classes... how are my standalone projects expected to find the latest .jar version of the library which they're both using...?
My expectation would be that somehow these versions of the library .jar would have to under GRADLE_USER_HOME (i.e. same location as all other dependency .jars).
Then I would assume that in the build.gradle of both standalone projects you'd have a line like
compile 'mylibrary:mylibrarymodule:3.+'
... of course the first part of these compile directives normally involves a "domain name in reverse" ... and this is normally used by a repository like Maven. How does it work with something which doesn't need to be published?
NB at the time of writing I don't have a Maven account as such and have no idea whether "publication" for re-use of a local common library project like this is essential or not.
Naturally, when I distribute versions of my standalone projects they will need to be packaged up with the library .jar in question.
A link to a how-to for a case like this would be more than welcome: I haven't found it under gradle.org.
If you are developing by yourself, you can use maven-publish plugin to publish your artifacts to local maven repository(you don't have to install maven for this) and on your dependent project you can simply say use mavenLocal repository for dependencies.
If you are on a company, I suggest installing a repository manager and deploy your artifacts to this repository so others can use. You can use their respective plugins to deploy easily. (Gradle Artifactory Plugin, Gradle Nexus Plugin, these are just deployment plugins, you have to setup respository manager to. There are other repository management tools also.) Doing the above process from CI server is the preferred way.
To use latest version of a dependency, you can use Gradle Versions Plugin. If the versioning happen often, using snapshot versions also a possibility.
My setup:
I'm using Grails 2.3.8
I have several private plugins I publish to my local Nexus repository manually via "grails publish-plugin"
I have several Grails applications that use these plugins
Distributed development team
My goal:
Able to deploy new versions of my private plugins and have my Grails apps automatically use those latest versions without having to modify their BuildConfig.groovy files
I know about inline/inplace plugin definitions and that is not what I want
Possible solutions:
As I understand it there might be at least two ways of achieving my goal:
Deploy snapshot versions of my plugins and have my Grails apps use those snapshot versions (e.g., version = "0.1-SNAPSHOT")
Configure my Grails apps's BuildConfig.groovy to use "latest.release" or Maven version ranges. Examples:
compile 'com.mycompany:some-plugin:latest.version'
compile 'com.mycompany:some-plugin:[0.1,)'
The problem:
The two methods above sort of work.
They both result in the latest version of my plugin to be downloaded, at least initially. However, if I publish a new version of the plugin (be it snapshot or release), re-running "grails run-app" on my Grails applications do not attempt to download/install the newer versions which are available.
I feel like the maven-metadata-*.xml files in my M2_HOME local repo are limiting the versions which are known to exist (even though Nexus has newer versions available).
When I define my Nexus repo using mavenRepo(), do I need to pass in some parameters to tell Grails to always check for new versions on the remote repo and not rely on the local repo?
Graeme's suggestion here does not seem to help either: Dependencies and lastest.release
Any help would be great. :-)
Have you configured the updatePolicy for the repository? See
http://grails.org/doc/latest/guide/conf.html#changingDependencies
Section "Aether and SNAPSHOT dependencies". Example:
mavenRepo "http://myrepo", {
updatePolicy "interval:1"
}
I'm using 2.3.7 and seemed to experience a similar problem. Using a SNAPSHOT plugin should be what you want during development. One workaround solution I used was to delete the SNAPSHOT release from Artifactory and then after building a new SNAPSHOT the plugin change was recognized. I am guessing you are using the Maven build which is now the default you could try switching to the ivy build and see if that helps. A JIRA should be created if you are able to recreate this. I believe this is an issue and I do not recall this when working with an older version (2.1.5) and using the ivy build.
I need to increment the project and subprojects release version , whitout create the new SNAPSHOT version.
I tried to use the Maven release plugin, but i found some incompatibility with my scm.
There are a plugin for only increment de buildnumber of a release named like 1.0-buildnumber?
I think I have wrongly interpreted the functions of the plug-in versions.
I did some tests, and I understand that this plugin allows you to update the pom.xml if the respective release has already been published.
This is not my case, what I need instead is to increase the release by increasing the BuildNumber so that the next phase of development can work using a new version of the project and subprojects.
I understand that this thing can be done only with the Maven release-plugin, but only in the context of using a scm.
If so,Thanks anyway for the support and sorry if I wasted your time.
In my current maven project I have a lot of submodules. I need to build a release and deploy it to my nexus...
Now I am facing the challange that I need for some of the modules differing version numbers. How can I handle this by usage of the release & deploy plugin? Or do I need some other maven plugins??? I configured the release plugin inside the parant pom. Is there a possibility to disable for example the "autoVersionSubmodules" for some of the submodules? Any ideas???
If you have a multi-module build than all modules should have the same version number otherwise it's an indicator that the multi-module build is not the right choice.
In a variety of places online I have seen it discussed that for a maven build to be reproducible it is important to explicitly specify the version numbers of all the plugins used so that a newer plugin does not break the build. The recommend approach seemed to be to use the enforcer plugin. Below is a copy and pasted settings I found online.
<execution>
<id>enforce-plugin-versions</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requirePluginVersions>
<message>Best Practice is to always define plugin versions!</message>
<banLatest>true</banLatest>
<banRelease>true</banRelease>
<banSnapshots>true</banSnapshots>
<phases>clean,deploy,site</phases>
<additionalPlugins>
<additionalPlugin>org.apache.maven.plugins:maven-eclipse-plugin</additionalPlugin>
<additionalPlugin>org.apache.maven.plugins:maven-reactor-plugin</additionalPlugin>
</additionalPlugins>
<unCheckedPluginList>org.apache.maven.plugins:maven-enforcer-plugin,org.apache.maven.plugins:maven-idea-plugin</unCheckedPluginList>
</requirePluginVersions>
</rules>
</configuration>
</execution>
When I run the pom I get the following error from the enforcer plugin.
[INFO] --- maven-enforcer-plugin:1.1.1:enforce (enforce-plugin-versions) # seedling ---
[WARNING] Rule 0: org.apache.maven.plugins.enforcer.RequirePluginVersions failed with message:
Some plugins are missing valid versions:(LATEST RELEASE SNAPSHOT are not allowed )
org.apache.maven.plugins:maven-clean-plugin. The version currently in use is 2.4.1
org.apache.maven.plugins:maven-deploy-plugin. The version currently in use is 2.7
org.apache.maven.plugins:maven-install-plugin. The version currently in use is 2.3.1
org.apache.maven.plugins:maven-site-plugin. The version currently in use is 3.0
org.apache.maven.plugins:maven-reactor-plugin. The version currently in use is 1.0
org.apache.maven.plugins:maven-eclipse-plugin. The version currently in use is 2.9
Best Practice is to always define plugin versions!
It seems to me that some plugins are such as maven-clean-plugin,maven-install-plugin,maven-reactor-plugin are a core central part of maven, and i should have the versions of these "core" plugins tied to the version of maven that I am using.
My questions:
Are plugin versions on the same release cycle as a maven itself?
Is there a group of core maven plugins that comprise a maven release? If yes, how to get a list of such plugins for a maven release?
When I see a maven release such as 3.0.4 is that version inclusive of some core plugins, or will it always get the latest plugins such as reactor that were released after maven 3.0.4 were released?
Is there a way to say to maven use plugins that were released at the time that 3.0.4 was released?
How is compatibility between different plugin versions indicated, is there some convention that is universally followed by plugins such as all minor 2.x are all compatible with each other but 3.x is not compatible with 2.x?
Is the practice of specifying plugin version numbers really a best pest practice or just overkill?
Maven binds some plugin to its lifecycle phases, e.g. the maven-compiler-plugin to the compile phase, the maven-install-plugin to the install phase and so on. These are the plugins that you mean by "a core central part of maven". However, these plugins have an individual release cycle. For example, take a look at the maven-deploy-plugin which is bound to maven's deploy lifecycle phase. The latest release (2.7) was in October 2011 whereas the latest Maven release (3.0.4) was in January 2012. Another example is the maven-compiler-plugin whose latest release was in June 2012, half a year after the release of Maven 3.0.4.
To answer your questions in particular:
No, they aren't. Each plugin has its own release cycle. See the examples above.
There are various plugins that are bound to Maven's package-specific lifecycle phases. You can consider these as "core maven plugins". Take a look at the maven book to get a complete list.
If you don't specify the plugin versions in your POM files, maven will use the latest release of each used plugin.
No. If this is a requirement for you, you can find the release dates of the plugins on http://search.maven.org and compare them to the latest release of Maven. But this shouldn't be necessary, if you specify the version of each used plugin in your POM file and maven produces the corrects artifacts for you.
There are no compatibility problems (at least no problems that I know of) between different maven plugins. For different version of the same plugin, you have to try it and see if your specific project works with a new version of a plugin.
If you want reproducible builds, it's a must.
Here the answers to the list of questions:
No
No. Maven itself has a small kernel but there are no plugins in the kernel. All plugins will be downloaded during the run if they needed. In Maven 2 there had been some parts of maven which are released with Maven itself (parts of the site generation) which has been changed with Maven 3.
No a Maven release includes a super pom which contains the definitions of some plugins versions etc. but only via the super pom.
No you can't define the time of a release only via the versions.
The different plugins are maintained by different communities / people and they have different opinions of versions and their relationship to the maven release. Usually the sites of the appropriate plugins will document that if it's documented (for example maven-site-plugin).
Yes it is and works for different Maven releases without any problems.