gr8crm / grails-sequence-generator

A Grails 3 plugin that provide sequence numbers (customer, order, invoice) to Grails applications
0 stars 5 forks source link

grails 3 jar #5

Open bfmuesli opened 6 years ago

bfmuesli commented 6 years ago

I am trying to use this plugin in grails 3, but unfortunately my attempts to build it fail with:

Error initializing classpath: Could not find org.gr8crm.sequence:sequence-generator-starter:0.0.1-SNAPSHOT.

Would it be possible to publish a .jar which I could include in my build.gradle? The old plugin references: compile "org.grails.plugins:sequence-generator:1.2" Since I can't find the newer plugin in grails 3 plugins, I assume it has not yet been published yet. Any help with this would be greatly appreciated.

goeh commented 6 years ago

What exact version of Grails 3 are you using? This plugin is dependent on https://github.com/gr8crm/sequence-generator-starter so you could try to clone that repo and run './gradlew install' to install it in your local Maven cache. Then you should be able to compile this plugin.

bfmuesli commented 6 years ago

Thank you for your help with this. This has been a very useful plugin for me in grails 2.

I have updated my app to grails 3 and am now running: | Grails Version: 3.2.11 | Groovy Version: 2.4.11 | JVM Version: 1.8.0_151 ./gradlew install works once I clone the sequence-generator-starter I ran grails package-plugin successfully after that. However, once I add the resulting .jar to the lib folder of my project the application won't start anymore. This happens even if I do not include it via: compile files("lib/grails-sequence-generator-1.0-SNAPSHOT.jar") in my build.gradle

The error message is rather long but this seems to be at the source of it:

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [grails.boot.config.GrailsApplicationPostProcessor]: Factory method 'grailsApplicationPostProcessor' threw exception; nested exception is java.lang.NoClassDefFoundError: org/gr8crm/sequence/SequenceConfiguration at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588) ... 23 common frames omitted Caused by: java.lang.NoClassDefFoundError: org/gr8crm/sequence/SequenceConfiguration

Is there something else I am doing wrong here?

bfmuesli commented 6 years ago

Here is how far I got (and a summary for others who might struggle with the same problem):

git clone https://github.com/gr8crm/sequence-generator-starter.git

cd sequence-generator-starter

./gradlew install

cd ../

git clone https://github.com/gr8crm/grails-sequence-generator.git

cd grails-sequence-generator

grails package-plugin

grails install (This was the step I was missing previously)`

after that I can add this to my build.gradle:

compile "grails.plugins.sequence:grails-sequence-generator:1.0-SNAPSHOT"

and the project will start. However if I annotate a domain class with @SequenceEntity it fails with:

startup failed:

Test.groovy: 6: unable to resolve class SequenceEntity ,  unable to find class for annotation
 @ line 6, column 1.
   @SequenceEntity
bfmuesli commented 6 years ago

any pointers as to how to resolve the issue above?

goeh commented 6 years ago

Did the import succeed but the annotation fail?

import grails.plugins.sequence.SequenceEntity

bfmuesli commented 6 years ago

The import succeeds with: import grails.plugins.sequence.* After that the annotation will fail Using your import above it will fail immediately.

goeh commented 6 years ago

So the plugin classes are not on your classpath then. But I can't understand why.

bfmuesli commented 6 years ago

Would you be able to point me to the location of SequenceEntity class in your code. I seem not to be able to find it in either the sequence-generator-starter nor the grails-sequence-generator. In the old grails 2 plugin it is located in: grails-sequence-generator/src/java/grails/plugins/sequence/

goeh commented 6 years ago

Ok, now I've done som research. It turns out that the SequenceEntity annotation is not supported/included in the Grails 3 version of the plugin. :-( I could not get it to work so it's still work in progress and not pushed to github.

goeh commented 6 years ago

I've now pushed my work-in-progress to the branch annotation-wip if you want to give it a try and make it work.