Closed NCarrellOmni closed 1 month ago
This is part of the unit testing of the project. Do as per https://github.com/davidmoten/odata-client/blob/master/odata-client-microsoft-dynamics/pom.xml. You seem to be using the alias for the namespace instead of the Namespace value. Just use the raw Namespace value: <namespace>Microsoft.Dynamics.CRM</namespace>
. The namespace value is obtained from this metadata line:
<edmx:DataServices>
<Schema xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="Microsoft.Dynamics.CRM" Alias="mscrm">
Ok, to demonstrate that generation works fine I copied the directory odata-client-microsoft-dynamics somewhere else and updated the pom so it looks like below. Built fine. You could use the below pom as guide.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>davemoten</groupId>
<artifactId>odata-client-microsoft-dynamics</artifactId>
<version>0.0.1-SNAPSHOT</version>
<description>Java client as template for Microsoft Dynamics organisation endpoints</description>
<properties>
<odata.client.version>0.2.3-SNAPSHOT</odata.client.version>
</properties>
<dependencies>
<dependency>
<groupId>com.github.davidmoten</groupId>
<artifactId>odata-client-microsoft-client-builder</artifactId>
<version>${odata.client.version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.14</version>
</dependency>
<!-- Test Dependencies -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.23.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.davidmoten</groupId>
<artifactId>junit-extras</artifactId>
<version>0.4</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.github.davidmoten</groupId>
<artifactId>odata-client-maven-plugin</artifactId>
<version>${odata.client.version}</version>
<executions>
<execution>
<id>generate-v1-client</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<metadata>src/main/odata/microsoft-dynamics-crm4-v9.1-metadata.xml</metadata>
<schemas>
<schema>
<namespace>Microsoft.Dynamics.CRM</namespace>
<packageName>microsoft.dynamics.crm</packageName>
<failOnMissingEntitySet>false</failOnMissingEntitySet>
</schema>
</schemas>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.6.0</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.build.directory}/generated-sources/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
BTW if I run mvn odata-client:generate
I get the same error as you. Just run mvn install
or to be more specific run mvn generate-sources
.
What you are missing is the execution id. It works for me if I run mvn odata-client:generate@generate-v1-client
.
On attempting to generate sources using the odata-client-maven-plugin v 0.2.1, I always get the error "
The parameters 'metadata' for goal com.github.davidmoten:odata-client-maven-plugin:0.2.1:generate are missing or invalid
". I am usingmvn odata-client:generate
when attempting to generate sources.I have some generated code in the 'target' directory which was successfully generated several months ago. Removing this generated code hasn't helped.
The project structure:
I downloaded the XML file provided in odata-client-microsoft-dynamics, microsoft-dynamics-crm4-v9.1-metadata.xml. I am still getting the same error. I changed the "namespace" property from
Microsoft.Dynamics.CRM
tomscrm
and this has not helped.I have tried doing the same on another computer with a new project with the same results.
Are we using this incorrectly? I have only been able to get sources to generate two times successfully, both were multiple months ago.
This is the pom.xml that we are using. The CRM metadata file has been renamed to "mscrm.xml" but the name doesn't seem to matter in this case.