Error in generateCode

Hi,
I have a very strange error when generating a simple module for testing purposes.
I created a module with a simple domain, when I run generateCode it generates its class and repository but with basic errors.


package br.com.sisprof.company.db;

import util.Objects.java;
import persistence.Entity.javax;
import hibernate.annotations.Type.org;

@javax
@javax.persistence.Table (name = “EMPRESA_EMPRESA”)
public class Empresa extends com {

The strangest thing is imports where he reversed the name by putting for example the .javax at the end and at the beginning.
Also weird cases like an @javax annotation and extends which is simply “com”

To better test I made a project with dependency of the axelor gradle plugin and manually executed the call to the class that generates the domain code and the result was correct.

My gradle from the 2 tests uses com.axelor: axelor-gradle: 5.2.2

The domain xml I used in my tests was this

<module name = "company" package = "br.com.sisprof.company.db" />

<entity name = "Company">
    <integer name = "code" title = "Code" />
    <string name = "SocialReason" title = "SocialReason" required = "true" min = "2" />
</entity>

After many tests and comparisons with the current version I was able to find the problem.
What happens is that the axelor-gradle plugin is totally incompatible with gradle version 5.+ and must be used with version 4.4.1 otherwise it generates totally wrong class code.
Looking at the source of the plugin I really do not understand the reason for this but I do not know gradle to understand the impact of the version with the code executed by the plugin.
Either way is the answer to the solution if someone has the same problem.

Hi,

All gradle commands belongs to the project, should be runned with provided gradlew wrapper script. Here I guess you installed and using gradle instead of gradlew.

Each Wrapper is tied to a specific version of Gradle. When you first run a commands for a given Gradle version, it will download the corresponding Gradle distribution and use it to execute the command. Standardizes a project on a given Gradle version, leading to more reliable and robust builds.

Note that on 5.3, we upgrade to gradle 5.6.4.

1 « J'aime »

thanks sir this solution works for me

i just rebuild everything from build i just directly use “./gradlew build” instead of “gradle build”

cheers

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.