My xtext-maven-plugin does not generate DSL code on project [message #1841327] |
Wed, 12 May 2021 08:34  |
Eclipse User |
|
|
|
Hi, I configured the root pom.xml in a project to test my DSL plugin via Maven, I followed the doc: https://www.eclipse.org/Xtext/documentation/350_continuous_integration.html#standalone-build.
But when I do:
mvn clean generate-sources
No code is generated, it seems that it does not recognize my .dsl file (main.dsl).
Here is the output of the command:
$ mvn clean generate-sources
[INFO] Scanning for projects...
[INFO]
[INFO] ----------< br.com.acme.cloud:base-produto-backend >-----------
[INFO] Building base-produto-backend 1.0.0-SNAPSHOT
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ base-produto-backend ---
[INFO] Deleting C:\mk\dev\git\base-produto-backend\target
[INFO]
[INFO] --- xtext-maven-plugin:2.25.0:generate (generate-trierdsl-artifacts) @ base-produto-backend ---
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$2 (file:/C:/Users/manutencao/.m2/repository/com/google/inject/guice/3.0/guice-3.0.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$2
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[INFO] Encoding: UTF-8
[INFO] Compiler source level: 11
[INFO] Compiler target level: 11
[INFO] Using common types.
[INFO] Collecting source models.
[INFO] Installing type provider.
[INFO] Generating stubs into C:\mk\dev\git\base-produto-backend\target\xtext-temp\stubs
[INFO] Compiling stubs located in C:\mk\dev\git\base-produto-backend\target\xtext-temp\stubs
[INFO] Nothing to compile. Stubs compilation was skipped.
[INFO] Installing type provider for stubs.
[INFO] Validate and generate.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.442 s
[INFO] Finished at: 2021-05-12T09:30:02-03:00
[INFO] ------------------------------------------------------------------------
In the Eclipse it works fine generating all the expected code.
I am using and xcore module in my grammar.
Heare is my pom.xml:
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>br.com.acme.cloud</groupId>
<artifactId>base-produto-backend</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<trierdsl.version>1.0.0-SNAPSHOT</trierdsl.version>
<xtext.version>2.25.0</xtext.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.xtext</groupId>
<artifactId>xtext-maven-plugin</artifactId>
<version>${xtext.version}</version>
<executions>
<execution>
<id>generate-trierdsl-artifacts</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<languages>
<language>
<setup>br.com.acme.trierdsl.TrierDSLStandaloneSetup</setup>
<outputConfigurations>
<outputConfiguration>
<outputDirectory>src/main/generated-sources/xtend/</outputDirectory>
</outputConfiguration>
</outputConfigurations>
</language>
</languages>
</configuration>
<dependencies>
<dependency>
<groupId>br.com.acme.trierdsl</groupId>
<artifactId>br.com.acme.trierdsl.model</artifactId>
<version>${trierdsl.version}</version>
</dependency>
<dependency>
<groupId>br.com.acme.trierdsl</groupId>
<artifactId>br.com.acme.trierdsl</artifactId>
<version>${trierdsl.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
Some tip to solve this issue?
|
|
|
|
|
|
|
|
|
|
|
|
Re: My xtext-maven-plugin does not generate DSL code on project [message #1841347 is a reply to message #1841338] |
Wed, 12 May 2021 14:18  |
Eclipse User |
|
|
|
Yes, now it is working like a charm with Maven. Thank you very much Christian.
This is my final root pom.xml, now the file main.dsl stay at the root of project and it is collected by the xtext-maven-plugin:
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>br.com.acme.cloud</groupId>
<artifactId>base-produto-backend</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<trierdsl.version>1.0.0</trierdsl.version>
<xtext.version>2.25.0</xtext.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<distributionManagement>
<repository>
<id>nexus</id>
<url>http://nexus.acme.com.br/content/repositories/releases</url>
</repository>
<snapshotRepository>
<id>nexus</id>
<url>http://nexus.acme.com.br/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.xtext</groupId>
<artifactId>xtext-maven-plugin</artifactId>
<version>${xtext.version}</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<sourceRoots>
<sourceRoot>${basedir}</sourceRoot>
</sourceRoots>
<languages>
<language>
<setup>br.com.acme.trierdsl.TrierDSLStandaloneSetup</setup>
<outputConfigurations>
<outputConfiguration>
<outputDirectory>${basedir}</outputDirectory>
</outputConfiguration>
</outputConfigurations>
</language>
</languages>
</configuration>
<dependencies>
<dependency>
<groupId>br.com.acme.trierdsl</groupId>
<artifactId>br.com.acme.trierdsl</artifactId>
<version>${trierdsl.version}</version>
</dependency>
<dependency>
<groupId>br.com.acme.trierdsl</groupId>
<artifactId>br.com.acme.trierdsl.model</artifactId>
<version>${trierdsl.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.12.0</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
|
|
|
Powered by
FUDForum. Page generated in 0.03769 seconds