yasuflatland-lf / damascus

⚔️ CRUD boilerplate generator for Liferay DXP
https://yasuflatland-lf.github.io/damascus-doc/
GNU Lesser General Public License v3.0
51 stars 35 forks source link

AnnotationTypeMismatchException from JCommander #47

Closed gbovyn closed 6 years ago

gbovyn commented 7 years ago

Hi,

I installed damascus with jpm as indicated in the wiki, but when I run it I get an AnnotationTypeMismatchException error.

I tried to compile it myself, same result as you can see below.

C:\...\damascus\build\libs>java -jar damascus.jar -init Todo -p todo
java.lang.annotation.AnnotationTypeMismatchException: Incorrectly typed data found for annotation element public abstract java.lang.Class[] com.beust.jcommander.Parameter.validateWith() (Found data of type class java.lang.Class[class com.liferay.damascus.cli.validators.ProjectNameValidator])
        at sun.reflect.annotation.AnnotationTypeMismatchExceptionProxy.generateException(Unknown Source)
        at sun.reflect.annotation.AnnotationInvocationHandler.invoke(Unknown Source)
        at com.sun.proxy.$Proxy2.validateWith(Unknown Source)
        at com.beust.jcommander.WrappedParameter.validateWith(WrappedParameter.java:55)
        at com.beust.jcommander.ParameterDescription.validateParameter(ParameterDescription.java:330)
        at com.beust.jcommander.ParameterDescription.addValue(ParameterDescription.java:233)
        at com.beust.jcommander.JCommander.processFixedArity(JCommander.java:895)
        at com.beust.jcommander.JCommander.processFixedArity(JCommander.java:870)
        at com.beust.jcommander.JCommander.parseValues(JCommander.java:721)
        at com.beust.jcommander.JCommander.parse(JCommander.java:340)
        at com.beust.jcommander.JCommander.parse(JCommander.java:319)
        at com.beust.jcommander.JCommander.<init>(JCommander.java:253)
        at com.liferay.damascus.cli.Damascus.run(Damascus.java:57)
        at com.liferay.damascus.cli.Damascus.main(Damascus.java:46)

I fixed it by using JCommander 1.71 (https://github.com/cbeust/jcommander/releases/tag/1.71)

-compile 'com.beust:jcommander:1.64'
+compile 'com.beust:jcommander:1.71'

Is there a reason why you rolled back to version 1.64 in commit https://github.com/yasuflatland-lf/damascus/commit/bc6270866d838f671b8a794f90fea48f1cd68f9c#diff-c197962302397baf3a4cc36463dce5ea?

yasuflatland-lf commented 6 years ago

Hi @gbovyn , thank you for reporting this and sorry for the inconvenience. I was busy when I got a report of an error from other people because of JCommander, so I simply rolled back after run the Unit test.

I switched to the latest version 1.72 and released as 0.14. Please use the latest version and it should fix the issue.

gbovyn commented 6 years ago

Hi @yasuflatland-lf, thank you for your answer, the issue is fixed.