SAP / cloud-sdk-java

Use the SAP Cloud SDK for Java to reduce development effort when building applications on SAP Business Technology Platform that communicate with SAP solutions and services such as SAP S/4HANA Cloud, SAP SuccessFactors, and many others.
Apache License 2.0
22 stars 12 forks source link

Unable it import autogenerated classes #484

Closed cviktorov closed 2 months ago

cviktorov commented 2 months ago

Hi Colleagues,

I am trying to generate classes from EDMX files using plugin

      <plugin>
            <groupId>com.sap.cloud.sdk.datamodel</groupId>
            <artifactId>odata-v4-generator-maven-plugin</artifactId>
            <!-- Please use the latest version here-->
            <version>5.9.0</version>
            <executions>
                <execution>
                    <id>generate-consumption</id>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                    <configuration>
                        <inputDirectory>${project.basedir}/edmx</inputDirectory>
                        <outputDirectory>${project.build.directory}/vdm</outputDirectory>
                        <deleteOutputDirectory>true</deleteOutputDirectory>
                        <packageName>com.sap.core.extensions.s4hana.auto</packageName>
                        <defaultBasePath>odata/v4/</defaultBasePath>
                        <compileScope>COMPILE</compileScope>
                        <serviceMethodsPerEntitySet>true</serviceMethodsPerEntitySet>
                    </configuration>
                </execution>
            </executions>
        </plugin>

I have imported depenencies

   <dependency>
        <groupId>com.sap.cloud.sdk.datamodel</groupId>
        <artifactId>odata-v4-core</artifactId>
    </dependency>
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <scope>provided</scope>
    </dependency>

It seems the the classes are generated successfully

autogenerated

But the problem is that I cannot import them in the source code. I use maven modules, tried in the same mode and in other module. Also, tried the plugin build-helper-maven-plugin, but still does not work

       <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <executions>
                <execution>
                    <id>add-source</id>
                    <phase>generate-sources</phase>
                    <configuration>
                        <sources>
                            <source>${project.build.directory}/vdm</source>
                        </sources>
                    </configuration>
                </execution>
            </executions>
        </plugin>

What do I make wrong?

Thanks!

Best regards, Tsvetislav

cviktorov commented 2 months ago

this fixed the issue https://stackoverflow.com/questions/25902126/intellij-will-not-recognize-antlr-generated-source-code/35946928