Include classpath of plugin dependencies in xtext-maven-plugin [message #1859085] |
Thu, 11 May 2023 08:00 |
Simon Cockx Messages: 69 Registered: October 2021 |
Member |
|
|
In a project that relies on generated code of my DSL, I'm using the xtext-maven-plugin for generating source files, i.e,
<plugin>
<groupId>org.eclipse.xtext</groupId>
<artifactId>xtext-maven-plugin</artifactId>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<sourceRoots>
<sourceRoot>${project.basedir}/src/test/resources</sourceRoot>
</sourceRoots>
<languages>
<language>
<setup>com.regnosys.rosetta.RosettaStandaloneSetup</setup>
<outputConfigurations>
<outputConfiguration>
<outputDirectory>${project.basedir}/src/test/generated/java
</outputDirectory>
</outputConfiguration>
</outputConfigurations>
</language>
</languages>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.regnosys.rosetta</groupId>
<artifactId>com.regnosys.rosetta</artifactId>
<version>${rosetta.dsl.version}</version>
</dependency>
</dependencies>
</plugin>
The project itself does not need a dependency on `com.regnosys.rosetta`, only the xtext-maven-plugin does for the generation.
The `com.regnosys.rosetta` artifact contains Rosetta files as well that need to be included during parsing. Because the xtext-maven-plugin scans the classpath of project dependencies, this works fine if I add `com.regnosys.rosetta` as an actual dependency. However, when I only specify it as a plugin dependency, it is not included.
Is there an option similar to the `includePluginDependencies` option of the `maven-exec-plugin` to include the classpath of these dependencies in the xtext-maven-plugin?
What I've tried is adding the following config.
<classpathElements>
${plugin.artifacts}
</classpathElements>
Unfortunately, this variable contains a list of `Artifact` instances, not strings, which the xtext-maven-plugin expects. This results in a cast error `class org.apache.maven.artifact.DefaultArtifact cannot be cast to class java.lang.String`.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03252 seconds