Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Include classpath of plugin dependencies in xtext-maven-plugin
Include classpath of plugin dependencies in xtext-maven-plugin [message #1859085] Thu, 11 May 2023 08:00 Go to next message
Simon Cockx is currently offline Simon CockxFriend
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`.
Re: Include classpath of plugin dependencies in xtext-maven-plugin [message #1859086 is a reply to message #1859085] Thu, 11 May 2023 08:12 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14685
Registered: July 2009
Senior Member
i fear you have to read the code e.g. around org.eclipse.xtext.maven.XtextGenerateMojo.getClasspathElements()
but it looks like it uses the projects classpath
so i fear its not possible



Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Include classpath of plugin dependencies in xtext-maven-plugin [message #1859088 is a reply to message #1859086] Thu, 11 May 2023 09:14 Go to previous message
Simon Cockx is currently offline Simon CockxFriend
Messages: 69
Registered: October 2021
Member
Alright, thanks. Raised an issue here: https://github.com/eclipse/xtext/issues/2665.
Previous Topic:Check unique names only in the provided scope
Next Topic:Xtext
Goto Forum:
  


Current Time: Thu Jun 13 17:14:22 GMT 2024

Powered by FUDForum. Page generated in 0.04338 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top