I generated the client code of IntegrationContent following the guidance(https://api.sap.com/api/IntegrationContent/cloud-sdk/Java) https://api.sap.com/api/IntegrationContent/cloud-sdk/Java.
According to the guidance, I downloaded the edmx,and config my maven plugin as below.
Acctually, I generated the code; but comparing to the apihub(https://api.sap.com/api/IntegrationContent/resource), some methods are lost.
Can anyone help on this?
<plugin>
<groupId>com.sap.cloud.sdk.datamodel</groupId>
<artifactId>odata-generator-maven-plugin</artifactId>
<!-- Please use always the latest version. You can find it on this page.-->
<version>3.64.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.sample</packageName>
<defaultBasePath>odata/v4/</defaultBasePath>
<compileScope>COMPILE</compileScope>
<serviceMethodsPerEntitySet>true</serviceMethodsPerEntitySet>
</configuration>
</execution>
</executions>
</plugin>
Related
In my JHipster service (single module project) I`m generating separate jacoco.xml for my unit tests suite and separate jacoco-it.xml report for integration tests.
I have tried to use report-aggreagate goal, but it was producing XML w/o any valuable data
plugin config:
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco-maven-plugin.version}</version>
<executions>
<execution>
<id>pre-unit-tests</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<!-- Ensures that the code coverage report for unit tests is created after unit tests have been run -->
<execution>
<id>post-unit-test</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>pre-integration-tests</id>
<goals>
<goal>prepare-agent-integration</goal>
</goals>
</execution>
<!-- Ensures that the code coverage report for integration tests is created after integration tests have been run -->
<execution>
<id>post-integration-tests</id>
<phase>post-integration-test</phase>
<goals>
<goal>report-integration</goal>
</goals>
</execution>
<!-- Merge unit and IT tests reports-->
<execution>
<id>merger-results</id>
<phase>verify</phase>
<goals>
<goal>report-aggregate</goal>
</goals>
<configuration>
<includeCurrentProject>true</includeCurrentProject>
</configuration>
</execution>
</executions>
</plugin>
aggregated report example:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><!DOCTYPE report PUBLIC "-//JACOCO//DTD Report 1.1//EN"
"report.dtd">
<report name="servicve">
<sessioninfo id="PC-b2895496" start="1667148896078" dump="1667148947953"/>
<sessioninfo id="PC-fa572e49" start="1667148951912" dump="1667149124611"/>
</report>
Is there any way to merge them into one report to see the combined test coverage report?
P.S. I know how to merge multiple .exec reports, but github actions require XML format.
For my project, I need to get xsd schemas that are kept in another project and generate my classes using maven-jaxb2-plugin. I am trying to get these Shema through my dependency (integration-pubsub-global-config), but I keep getting errors : [ERROR] Error while parsing schema(s).Location []. Here is my configuration for the plugin :
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.13.2</version>
<executions>
<execution>
<id>generate-sources-message</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<extension>true</extension>
<args>
<arg>-XtoString</arg>
<arg>-Xequals</arg>
<arg>-XhashCode</arg>
</args>
<bindingDirectory>${basedir}/src/main/jaxws</bindingDirectory>
<bindingIncludes>
<include>bindings.xml</include>
</bindingIncludes>
<schemas>
<schema>
<dependencyResource>
<groupId>com.XXXXX.YYYYYY-YYYY.integration</groupId>
<artifactId>integration-pubsub-global-config</artifactId>
<resource>src/export/pubsub-xsd-contracts/SM840-IntegrationEvenements/Donnees/Event/EventV3.xsd</resource>
</dependencyResource>
</schema>
</schemas>
<generateDirectory>${cxf.generated.sources.folder}</generateDirectory>
<enableIntrospection>true</enableIntrospection>
<plugins>
<plugin>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics</artifactId>
<version>0.5.3</version>
</plugin>
</plugins>
</configuration>
</execution>
</executions>
</plugin>
Background
I am facing excessive logging from default Logger when I run scala tests from maven because it is not picking up the logback.xml on the classpath with the correct logging definitions
So my maven config is fairly generic (as per scalatest-maven-plugin docs)
Looks like this
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.7</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<!-- enable scalatest -->
<plugin>
<groupId>org.scalatest</groupId>
<artifactId>scalatest-maven-plugin</artifactId>
<version>1.0</version>
<configuration>
<reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
<junitxml>.</junitxml>
<filereports>MyProj_TestSuite.txt</filereports>
<forkMode>never</forkMode>
</configuration>
<executions>
<execution>
<id>test</id>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
I have a logback.xml in my src/main/resources which gets copied over to target/classes
Things I tried so far
Have spent a whole day to figure out why this is not being picked up -- using the following configuration optional entries
<runpath>
${project.basedir}/target/classes
</runpath>
<systemProperties>
<logback.configurationFile> ${project.basedir}/src/main/resources/logback.xml</logback.configurationFile>
</systemProperties>
<argLine>
-Dlogback.configurationFile=src/main/resources/logback.xml
</argLine>
If I run it like this (from command line) from ${project.basedir}
mvn test -Dlogback.configurationFile=./src/test/resources/logback.xml
it works
I have looked at similar issues on stack and even tried adding this
<build>
<testResources>
<testResource>
<directory>${project.basedir}/target/classes</directory>
</testResource>
<testResource>
<directory>${project.basedir}/src/test/resources</directory>
</testResource>
</testResources>
</build>
This did not work - I think it is because I am using scala-maven-test plugin which has its own configuration block.
Any help on how to do this from inside the pom.xml will be much appreciated.
Try to have /src/test/resources/logback-test.xml logback configuration file.
It works for me with scalatest-maven-plugin of 2.0.2 version.
How do i generate code for multiple swagger files from within the same module/project in one pom.xml.
In my application client had provided a swagger and we have one of the backend API to be called for which they provided swagger. I want to generate code for both of these in the same project. One way i was thinking is create separate module and execute the plugin separately and have those dependencies called out in main module.
How do i generate code from one build plugin? Please point me to existing one if it is a repost. I couldn't find any.
Here is the plugin i configured in pom.xml
<plugin>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/ resources/Service.json</inputSpec><inputSpec>${project.basedir}/src /main/resources/Client.json</inputSpec>
<language>java</language>
<configOptions>
<dateLibrary>java8</dateLibrary>
</configOptions>
<modelPackage>com.service.model</modelPackage>
<environmentVariables>
<models/>
<supportingFiles>false</supportingFiles>
</environmentVariables>
</configuration>
</execution>
</executions>
</plugin>
Also tried *.json. At anytime it is taking only one json file and generating the code.
In order to do this you could declare a different execution for each json file, each one should have a unique id.
Here is an example with two executions, execution-first-json for the file first.json and execution-second-json for the file second.json
<plugin>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>execution-first-json</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/first.json</inputSpec>
<language>java</language>
<configOptions>
<dateLibrary>java8</dateLibrary>
</configOptions>
<modelPackage>com.service.model</modelPackage>
<environmentVariables>
<models/>
<supportingFiles>false</supportingFiles>
</environmentVariables>
</configuration>
</execution>
<execution>
<id>execution-second-json</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/second.json</inputSpec>
<language>java</language>
<configOptions>
<dateLibrary>java8</dateLibrary>
</configOptions>
<modelPackage>com.service.model</modelPackage>
<environmentVariables>
<models/>
<supportingFiles>false</supportingFiles>
</environmentVariables>
</configuration>
</execution>
</executions>
</plugin>
I'm using maven 3.3.9 and the maven-jaxb2-plugin 0.13.1. But when I try to generate the Java classes, the plugin is not finding my XSD-file.
My pom looks like this:
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.13.1</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<schemaDirectory>src/main/resources/schemas</schemaDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
Everytime I'm executing the goal, I get this message:
[WARNING] No schemas to compile. Skipping XJC execution.
The directory exists under the resources folder, and the XSD is placed there. I have no other pom-files in play.
Any help would be very much appreciated
In case anyone else will hit this. I had a similar issue: the configuration was not picked up by the plugin. I made it work by moving configuration section under plugin declaration instead of execution.
Here's how the working configuration looked like for me (I removed the upper-level elements since they do not matter):
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.15.1</version>
<configuration>
<schemaDirectory>src/main/resources/custom-schemas</schemaDirectory>
</configuration>
<executions>
<execution>
<id>generate</id>
<goals>
<goal>generate</goal>
</goals>
</execution>
/executions>
</plugin>
Author of maven-jaxb2-plugin here.
Somehow I have a feeling that you're omitting important details. This does not not add up. This is a very basic configuration setting, I'm curious how it can't work.
You only post the pluginManagement part of your pom.xml. If you have just this, it should not work at all as it is just and only a declaration of configuration, not actual usage of the plugin. You need plugins/plugin to actually apply the plugin:
<project ...>
...
<build>
<plugins>
...
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>...</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
...
</plugins>
</build>
...
</project>
To analyze the problem, run mvn -X clean generate-sources or mvn -X clean install and check the applied configuration (it will be logged). Post the log here.
If this does not help, send me a PR of a minimal reproducing project under https://github.com/highsource/maven-jaxb2-plugin-support/s/schemaDirectory, I'll take a look.