grails3 various questions / best practices

245 views
Skip to first unread message

Vahid Hedayati

unread,
Mar 5, 2015, 7:45:52 AM3/5/15
to grails-de...@googlegroups.com
Hi All

Sorry to bombard the list with a variety of questions.

1. In regards to git I have so far created new repos with the names of grails3-pluginame, I had been thinking previously to keep the same old repo on git and just create a new branch for old grails 2 and a new branch for grails3.
What would be the best practise for this ?



2. I am still trying to get my head around grails3 and there are a few questions


2.1 - In grails2 application.properties defined version info, in grails3 it is build.gradle:
version "0.43"

2.1.1  should the new grails3 plugins start from 0.1 again or continue from where grails2 numbering version was left off.


2.2 Actual plugin name not being picked up from plugin descriptor,

I did create-plugin grails3-plugin-name, after following the instructions for the plugin descriptor when I do package-plugin I end up with grails3-pluginame...


Finally when I attempted to publish - the incorrectly named plugin:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':publishMavenPublicationToMavenRepository'.
> Failed to publish publication 'maven' to repository 'maven'
   > Error deploying artifact 'org.grails.plugins:grails3-ajaxdependancyselection:jar': Error deploying artifact: Failed to transfer file: https://repo.grails.org/grails/plugins3-snapshots-local/org/grails/plugins/grails3-ajaxdependancyselection/0.1-SNAPSHOT/grails3-ajaxdependancyselection-0.1-20150305.123012-1.jar. Return code is: 401

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Although it manages to package the plugin..




grails package-plugin
:assetCompile UP-TO-DATE
:compileAstJava UP-TO-DATE
:compileAstGroovy UP-TO-DATE
:processAstResources UP-TO-DATE
:astClasses UP-TO-DATE
:compileJava UP-TO-DATE
:configScript
:compileGroovy UP-TO-DATE
:copyAstClasses UP-TO-DATE
:copyCommands UP-TO-DATE
:copyTemplates UP-TO-DATE
:processResources UP-TO-DATE
:classes UP-TO-DATE
:compileWebappGroovyPages UP-TO-DATE
:compileGroovyPages
:jar
:findMainClass
:startScripts
:distTar
:distZip
:bootRepackage
:assemble

BUILD SUCCESSFUL

Total time: 3.291 secs

I have published them all on git the above plugin is https://github.com/vahidhedayati/grails3-ajaxdependancyselection

Regards
Vahid




Graeme Rocher

unread,
Mar 5, 2015, 8:09:32 AM3/5/15
to grails-de...@googlegroups.com
Answers below....

On Thu, Mar 5, 2015 at 1:45 PM, Vahid Hedayati <bad...@gmail.com> wrote:
> Hi All
>
> Sorry to bombard the list with a variety of questions.
>
> 1. In regards to git I have so far created new repos with the names of
> grails3-pluginame, I had been thinking previously to keep the same old repo
> on git and just create a new branch for old grails 2 and a new branch for
> grails3.
> What would be the best practise for this ?


Yes to maintain the history and allow merges 2 branches works well, we
do this for some plugins (asset pipeline)


>
>
>
> 2. I am still trying to get my head around grails3 and there are a few
> questions
>
>
> 2.1 - In grails2 application.properties defined version info, in grails3 it
> is build.gradle:
> version "0.43"

Yes in fact you can remove application.properties and also the version
property in your *GrailsPlugin descriptor

>
> 2.1.1 should the new grails3 plugins start from 0.1 again or continue from
> where grails2 numbering version was left off.

For most plugins we have just continued where grails2 left off

>
>
> 2.2 Actual plugin name not being picked up from plugin descriptor,
>
> I did create-plugin grails3-plugin-name, after following the instructions
> for the plugin descriptor when I do package-plugin I end up with
> grails3-pluginame...

You will en up with a JAR file in build/libs that is your plugin JAR

>
>
> Finally when I attempted to publish - the incorrectly named plugin:
>
> FAILURE: Build failed with an exception.
>
> * What went wrong:
> Execution failed for task ':publishMavenPublicationToMavenRepository'.
>> Failed to publish publication 'maven' to repository 'maven'
> > Error deploying artifact
> 'org.grails.plugins:grails3-ajaxdependancyselection:jar': Error deploying
> artifact: Failed to transfer file:
> https://repo.grails.org/grails/plugins3-snapshots-local/org/grails/plugins/grails3-ajaxdependancyselection/0.1-SNAPSHOT/grails3-ajaxdependancyselection-0.1-20150305.123012-1.jar.
> Return code is: 401
>
> * Try:
> Run with --stacktrace option to get the stack trace. Run with --info or
> --debug option to get more log output.
>
> BUILD FAILED
>
> Although it manages to package the plugin..


It is by default configured to publish to our artifactory instance for
Grails, right now we recommend people publish to maven local and
bintray. You can create a bintray account and publish your plugin
releases there.
> --
> You received this message because you are subscribed to the Google Groups
> "Grails Dev Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to grails-dev-disc...@googlegroups.com.
> To post to this group, send email to grails-de...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/grails-dev-discuss/5464db0f-e926-411e-8aa9-b8c89f968b36%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Graeme Rocher

Vahid Hedayati

unread,
Mar 5, 2015, 9:58:56 AM3/5/15
to grails-de...@googlegroups.com
Thank you Graeme

And for any other people stuck on any of these points, I hope I am correct on the following.


1. To publish locally - run

mvn install


2. The plugin name where before controlled via plugin descriptor is also defined in 2 other places:
grails-app/conf/application.yml

---
grails:
  profile: web-plugin
  codegen:
    defaultPackage: jssh


grails-app/init/jssh/  {foldername}
and in Application.groovy {packagename}


Regards
Vahid

Vahid Hedayati

unread,
Mar 6, 2015, 5:58:23 AM3/6/15
to grails-de...@googlegroups.com

Hi All


I have decided to put together some useful information in regards to porting plugins to 3 and relevant links / information on how to understand what to do :



https://gist.github.com/vahidhedayati/46006e815cf31134d4ff


So far there is a few things I  can't get my head around.

I was talking about mvn install in my email yesterday which will only work if you have a pom.xml  ( I am still unsure how I managed to generate this) but having read further into it. I really don't think there is a need for mvn install or pom.xml since you should really be using

grails install

or the instructions of inline plugin all in the above gist page...


I am currently stuck on g:remoteForm call which from what I can see is covered by the new ajax-tags plugin under grails3.

I have not been able to figure out how to call these available plugins from my plugin.

under dependencies I have tried:

 //compile "org.grails:ajax-tags:1.0.0.BUILD-SNAPSHOT"
 //compile "ajax-tags"
  //compile plugin(':ajax-tags')



and also tried:

version "1.15"
group "org.grails.plugins"

apply plugin: "spring-boot"
...
//apply plugin: 'ajax-tags'


None of which has worked for me so far...

What would be the process of including  or using these available plugins within a new plugin?
Reply all
Reply to author
Forward
0 new messages