Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » My xtext-maven-plugin does not generate DSL code on project
My xtext-maven-plugin does not generate DSL code on project [message #1841327] Wed, 12 May 2021 12:34 Go to next message
Márcio Koch is currently offline Márcio KochFriend
Messages: 54
Registered: August 2013
Member
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 #1841328 is a reply to message #1841327] Wed, 12 May 2021 12:40 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14062
Registered: July 2009
Senior Member
did you run maven with -X to see if there can be any resources found and if the correct folders are checked?
i also wonder what
<artifactId>br.com.acme.trierdsl.model</artifactId>
is doing


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: My xtext-maven-plugin does not generate DSL code on project [message #1841329 is a reply to message #1841328] Wed, 12 May 2021 12:53 Go to previous messageGo to next message
Márcio Koch is currently offline Márcio KochFriend
Messages: 54
Registered: August 2013
Member
Thank you for the reply Christian.
If I not put the br.com.acme.trierdsl.model dependency in the pom.xml, some errors occur because it does not find classes that exists in my xcore project:
$ 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] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.942 s
[INFO] Finished at: 2021-05-12T09:46:59-03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.eclipse.xtext:xtext-maven-plugin:2.25.0:generate (generate-trierdsl-artifacts) on project base-produto-backend: Execution generate-trierdsl-artifacts of goal org.eclipse.xtext:xtext-maven-plugin:2.25.0:generate failed: A required class was missing while executing org.eclipse.xtext:xtext-maven-plugin:2.25.0:generate: br/com/acme/trierdsl/model/DomainModel
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.eclipse.xtext:xtext-maven-plugin:2.25.0
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/Users/manutencao/.m2/repository/org/eclipse/xtext/xtext-maven-plugin/2.25.0/xtext-maven-plugin-2.25.0.jar
[ERROR] urls[1] = file:/C:/Users/manutencao/.m2/repository/br/com/acme/trierdsl/br.com.acme.trierdsl/1.0.0-SNAPSHOT/br.com.acme.trierdsl-1.0.0-SNAPSHOT.jar
[ERROR] urls[2] = file:/C:/Users/manutencao/.m2/repository/org/eclipse/xtext/org.eclipse.xtext.builder.standalone/2.25.0/org.eclipse.xtext.builder.standalone-2.25.0.jar
[ERROR] urls[3] = file:/C:/Users/manutencao/.m2/repository/org/eclipse/xtext/org.eclipse.xtext.xbase/2.25.0/org.eclipse.xtext.xbase-2.25.0.jar
[ERROR] urls[4] = file:/C:/Users/manutencao/.m2/repository/org/eclipse/xtext/org.eclipse.xtext.common.types/2.25.0/org.eclipse.xtext.common.types-2.25.0.jar
[ERROR] urls[5] = file:/C:/Users/manutencao/.m2/repository/org/ow2/asm/asm-commons/9.1/asm-commons-9.1.jar
[ERROR] urls[6] = file:/C:/Users/manutencao/.m2/repository/org/ow2/asm/asm/9.1/asm-9.1.jar
[ERROR] urls[7] = file:/C:/Users/manutencao/.m2/repository/org/ow2/asm/asm-tree/9.1/asm-tree-9.1.jar
[ERROR] urls[8] = file:/C:/Users/manutencao/.m2/repository/org/ow2/asm/asm-analysis/9.1/asm-analysis-9.1.jar
[ERROR] urls[9] = file:/C:/Users/manutencao/.m2/repository/io/github/classgraph/classgraph/4.8.35/classgraph-4.8.35.jar
[ERROR] urls[10] = file:/C:/Users/manutencao/.m2/repository/org/eclipse/platform/org.eclipse.equinox.common/3.13.0/org.eclipse.equinox.common-3.13.0.jar
[ERROR] urls[11] = file:/C:/Users/manutencao/.m2/repository/org/eclipse/platform/org.eclipse.core.runtime/3.19.0/org.eclipse.core.runtime-3.19.0.jar
[ERROR] urls[12] = file:/C:/Users/manutencao/.m2/repository/org/eclipse/platform/org.eclipse.osgi/3.16.0/org.eclipse.osgi-3.16.0.jar
[ERROR] urls[13] = file:/C:/Users/manutencao/.m2/repository/org/eclipse/platform/org.eclipse.core.jobs/3.10.800/org.eclipse.core.jobs-3.10.800.jar
[ERROR] urls[14] = file:/C:/Users/manutencao/.m2/repository/org/eclipse/platform/org.eclipse.equinox.registry/3.9.0/org.eclipse.equinox.registry-3.9.0.jar
[ERROR] urls[15] = file:/C:/Users/manutencao/.m2/repository/org/eclipse/platform/org.eclipse.equinox.preferences/3.8.0/org.eclipse.equinox.preferences-3.8.0.jar
[ERROR] urls[16] = file:/C:/Users/manutencao/.m2/repository/org/eclipse/platform/org.eclipse.core.contenttype/3.7.800/org.eclipse.core.contenttype-3.7.800.jar
[ERROR] urls[17] = file:/C:/Users/manutencao/.m2/repository/org/eclipse/platform/org.eclipse.equinox.app/1.5.0/org.eclipse.equinox.app-1.5.0.jar
[ERROR] urls[18] = file:/C:/Users/manutencao/.m2/repository/org/eclipse/jdt/org.eclipse.jdt.core/3.23.0/org.eclipse.jdt.core-3.23.0.jar
[ERROR] urls[19] = file:/C:/Users/manutencao/.m2/repository/org/eclipse/platform/org.eclipse.core.resources/3.13.800/org.eclipse.core.resources-3.13.800.jar
[ERROR] urls[20] = file:/C:/Users/manutencao/.m2/repository/org/eclipse/platform/org.eclipse.core.expressions/3.7.0/org.eclipse.core.expressions-3.7.0.jar
[ERROR] urls[21] = file:/C:/Users/manutencao/.m2/repository/org/eclipse/platform/org.eclipse.core.filesystem/1.7.700/org.eclipse.core.filesystem-1.7.700.jar
[ERROR] urls[22] = file:/C:/Users/manutencao/.m2/repository/org/eclipse/platform/org.eclipse.text/3.10.300/org.eclipse.text-3.10.300.jar
[ERROR] urls[23] = file:/C:/Users/manutencao/.m2/repository/org/eclipse/platform/org.eclipse.core.commands/3.9.700/org.eclipse.core.commands-3.9.700.jar
[ERROR] urls[24] = file:/C:/Users/manutencao/.m2/repository/org/eclipse/jdt/org.eclipse.jdt.compiler.apt/1.3.1100/org.eclipse.jdt.compiler.apt-1.3.1100.jar
[ERROR] urls[25] = file:/C:/Users/manutencao/.m2/repository/org/eclipse/jdt/org.eclipse.jdt.compiler.tool/1.2.1000/org.eclipse.jdt.compiler.tool-1.2.1000.jar
[ERROR] urls[26] = file:/C:/Users/manutencao/.m2/repository/org/eclipse/xtext/org.eclipse.xtext.ecore/2.25.0/org.eclipse.xtext.ecore-2.25.0.jar
[ERROR] urls[27] = file:/C:/Users/manutencao/.m2/repository/org/eclipse/xtext/org.eclipse.xtext/2.25.0/org.eclipse.xtext-2.25.0.jar
[ERROR] urls[28] = file:/C:/Users/manutencao/.m2/repository/org/eclipse/xtext/org.eclipse.xtext.util/2.25.0/org.eclipse.xtext.util-2.25.0.jar
[ERROR] urls[29] = file:/C:/Users/manutencao/.m2/repository/org/eclipse/xtend/org.eclipse.xtend.lib/2.25.0/org.eclipse.xtend.lib-2.25.0.jar
[ERROR] urls[30] = file:/C:/Users/manutencao/.m2/repository/org/eclipse/xtext/org.eclipse.xtext.xbase.lib/2.25.0/org.eclipse.xtext.xbase.lib-2.25.0.jar
[ERROR] urls[31] = file:/C:/Users/manutencao/.m2/repository/com/google/guava/guava/30.1-jre/guava-30.1-jre.jar
[ERROR] urls[32] = file:/C:/Users/manutencao/.m2/repository/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar
[ERROR] urls[33] = file:/C:/Users/manutencao/.m2/repository/com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar
[ERROR] urls[34] = file:/C:/Users/manutencao/.m2/repository/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar
[ERROR] urls[35] = file:/C:/Users/manutencao/.m2/repository/org/checkerframework/checker-qual/3.5.0/checker-qual-3.5.0.jar
[ERROR] urls[36] = file:/C:/Users/manutencao/.m2/repository/com/google/errorprone/error_prone_annotations/2.3.4/error_prone_annotations-2.3.4.jar
[ERROR] urls[37] = file:/C:/Users/manutencao/.m2/repository/com/google/j2objc/j2objc-annotations/1.3/j2objc-annotations-1.3.jar
[ERROR] urls[38] = file:/C:/Users/manutencao/.m2/repository/org/eclipse/xtend/org.eclipse.xtend.lib.macro/2.25.0/org.eclipse.xtend.lib.macro-2.25.0.jar
[ERROR] urls[39] = file:/C:/Users/manutencao/.m2/repository/org/eclipse/emf/org.eclipse.emf.common/2.17.0/org.eclipse.emf.common-2.17.0.jar
[ERROR] urls[40] = file:/C:/Users/manutencao/.m2/repository/com/google/inject/guice/3.0/guice-3.0.jar
[ERROR] urls[41] = file:/C:/Users/manutencao/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar
[ERROR] urls[42] = file:/C:/Users/manutencao/.m2/repository/org/antlr/antlr-runtime/3.2/antlr-runtime-3.2.jar
[ERROR] urls[43] = file:/C:/Users/manutencao/.m2/repository/org/eclipse/xtext/org.eclipse.xtext.xtext.generator/2.25.0/org.eclipse.xtext.xtext.generator-2.25.0.jar
[ERROR] urls[44] = file:/C:/Users/manutencao/.m2/repository/org/eclipse/emf/org.eclipse.emf.codegen/2.19.0/org.eclipse.emf.codegen-2.19.0.jar
[ERROR] urls[45] = file:/C:/Users/manutencao/.m2/repository/org/eclipse/jdt/org.eclipse.jdt.launching/3.18.0/org.eclipse.jdt.launching-3.18.0.jar
[ERROR] urls[46] = file:/C:/Users/manutencao/.m2/repository/org/eclipse/jdt/org.eclipse.jdt.debug/3.16.0/org.eclipse.jdt.debug-3.16.0.jar
[ERROR] urls[47] = file:/C:/Users/manutencao/.m2/repository/org/eclipse/platform/org.eclipse.core.variables/3.4.800/org.eclipse.core.variables-3.4.800.jar
[ERROR] urls[48] = file:/C:/Users/manutencao/.m2/repository/org/eclipse/platform/org.eclipse.debug.core/3.16.0/org.eclipse.debug.core-3.16.0.jar
[ERROR] urls[49] = file:/C:/Users/manutencao/.m2/repository/org/eclipse/emf/org.eclipse.emf.codegen.ecore/2.20.0/org.eclipse.emf.codegen.ecore-2.20.0.jar
[ERROR] urls[50] = file:/C:/Users/manutencao/.m2/repository/org/eclipse/emf/org.eclipse.emf.mwe.utils/1.6.1/org.eclipse.emf.mwe.utils-1.6.1.jar
[ERROR] urls[51] = file:/C:/Users/manutencao/.m2/repository/org/eclipse/emf/org.eclipse.emf.mwe.core/1.6.1/org.eclipse.emf.mwe.core-1.6.1.jar
[ERROR] urls[52] = file:/C:/Users/manutencao/.m2/repository/commons-cli/commons-cli/1.2/commons-cli-1.2.jar
[ERROR] urls[53] = file:/C:/Users/manutencao/.m2/repository/commons-logging/commons-logging/1.1.3/commons-logging-1.1.3.jar
[ERROR] urls[54] = file:/C:/Users/manutencao/.m2/repository/org/eclipse/emf/org.eclipse.emf.mwe2.lib/2.12.1/org.eclipse.emf.mwe2.lib-2.12.1.jar
[ERROR] urls[55] = file:/C:/Users/manutencao/.m2/repository/org/eclipse/emf/org.eclipse.emf.mwe2.runtime/2.12.1/org.eclipse.emf.mwe2.runtime-2.12.1.jar
[ERROR] urls[56] = file:/C:/Users/manutencao/.m2/repository/org/eclipse/emf/org.eclipse.emf.ecore.xmi/2.16.0/org.eclipse.emf.ecore.xmi-2.16.0.jar
[ERROR] urls[57] = file:/C:/Users/manutencao/.m2/repository/org/eclipse/emf/org.eclipse.emf.ecore/2.20.0/org.eclipse.emf.ecore-2.20.0.jar
[ERROR] urls[58] = file:/C:/Users/manutencao/.m2/repository/log4j/log4j/1.2.17/log4j-1.2.17.jar
[ERROR] urls[59] = file:/C:/Users/manutencao/.m2/repository/org/codehaus/plexus/plexus-utils/1.1/plexus-utils-1.1.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------
[ERROR] : br.com.acme.trierdsl.model.DomainModel
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException
Re: My xtext-maven-plugin does not generate DSL code on project [message #1841330 is a reply to message #1841329] Wed, 12 May 2021 13:00 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14062
Registered: July 2009
Senior Member
so model contains your metamodel. then its fine.
that is the output with -X and model?

there should be something like this in the log

[DEBUG] Source dirs: /Users/cdietrich/git/xtext-maven-example/org.xtext.example.mydsl.model/src, /Users/cdietrich/git/xtext-maven-example/org.xtext.example.mydsl.model/src-gen, /Users/cdietrich/git/xtext-maven-example/org.xtext.example.mydsl.model/xtend-gen
[DEBUG] Java source dirs: /Users/cdietrich/git/xtext-maven-example/org.xtext.example.mydsl.model/src, /Users/cdietrich/git/xtext-maven-example/org.xtext.example.mydsl.model/src-gen, /Users/cdietrich/git/xtext-maven-example/org.xtext.example.mydsl.model/xtend-gen
....
[INFO] Collecting source models.
[INFO] Adding file 'file:/Users/cdietrich/git/xtext-maven-example/org.xtext.example.mydsl.model/src/test.mydsl'



Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: My xtext-maven-plugin does not generate DSL code on project [message #1841332 is a reply to message #1841330] Wed, 12 May 2021 13:55 Go to previous messageGo to next message
Márcio Koch is currently offline Márcio KochFriend
Messages: 54
Registered: August 2013
Member
It seems be specting that may main.dsl file should be in the dir: ./src/main/java/
...
[INFO] Encoding: UTF-8
[INFO] Compiler source level: 11
[INFO] Compiler target level: 11
[DEBUG] Source dirs: C:\mk\dev\git\base-pessoa-backend\src\main\java
[DEBUG] Java source dirs: C:\mk\dev\git\base-pessoa-backend\src\main\java
[DEBUG] Classpath entries:
[INFO] Using common types.
[INFO] Setting encoding.
[INFO] Collecting source models.
[INFO] Adding file 'file:/C:/mk/dev/git/base-pessoa-backend/src/main/java/main.dsl'
[INFO] Finished collecting source models. Took: 15 ms.
[INFO] Installing type provider.
...


But I want that the main.dsl stay in the root project togetter with my root pom.xml file.
my-project
--pom.xml
--main.dsl


So for tests, I put the main.dsl file into the dir ./src/main/java and the .dsl file was collected, but some erros occurs because the use of xcore model project:
[DEBUG] Configuring mojo org.eclipse.xtext:xtext-maven-plugin:2.25.0:generate from plugin realm ClassRealm[plugin>org.eclipse.xtext:xtext-maven-plugin:2.25.0, parent: jdk.internal.loader.ClassLoaders$AppClassLoader@30946e09]
[DEBUG] Configuring mojo 'org.eclipse.xtext:xtext-maven-plugin:2.25.0:generate' with basic configurator -->
[DEBUG]   (f) autoFillPlatformResourceMap = false
[DEBUG]   (f) classpathElements = [C:\mk\dev\git\base-pessoa-backend\target\classes]
[DEBUG]   (f) compilerPreserveInformationAboutFormalParameters = false
[DEBUG]   (f) compilerSkipAnnotationProcessing = false
[DEBUG]   (f) compilerSourceLevel = 11
[DEBUG]   (f) compilerTargetLevel = 11
[DEBUG]   (f) encoding = UTF-8
[DEBUG]   (f) failOnValidationError = true
[DEBUG]   (f) javaSourceRoots = [C:\mk\dev\git\base-pessoa-backend\src\main\java]
[DEBUG]   (s) setup = org.eclipse.xtend.core.XtendStandaloneSetup
[DEBUG]   (s) outputDirectory = C:\mk\dev\git\base-pessoa-backend/src/main/java-gen
[DEBUG]   (s) outputConfigurations = [org.eclipse.xtext.maven.OutputConfiguration@45c2e0a6]
[DEBUG]   (s) setup = br.com.triersistemas.trierdsl.TrierDSLStandaloneSetup
[DEBUG]   (s) outputDirectory = src/main/generated-sources/xtend/
[DEBUG]   (s) outputConfigurations = [org.eclipse.xtext.maven.OutputConfiguration@119c745c]
[DEBUG]   (s) languages = [org.eclipse.xtext.maven.Language@a7ad6e5, org.eclipse.xtext.maven.Language@3b1ed14b]
[DEBUG]   (f) project = MavenProject: br.com.triersistemas.cloud:base-pessoa-backend:1.0.0-SNAPSHOT @ C:\mk\dev\git\base-pessoa-backend\pom.xml
[DEBUG]   (f) skip = false
[DEBUG]   (f) sourceRoots = [C:\mk\dev\git\base-pessoa-backend\src\main\java]
[DEBUG]   (f) tmpClassDirectory = C:\mk\dev\git\base-pessoa-backend\target/xtext-temp
[DEBUG] -- end configuration --
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
[DEBUG] Source dirs: C:\mk\dev\git\base-pessoa-backend\src\main\java
[DEBUG] Java source dirs: C:\mk\dev\git\base-pessoa-backend\src\main\java
[DEBUG] Classpath entries:
[INFO] Using common types.
[INFO] Setting encoding.
[INFO] Collecting source models.
[INFO] Adding file 'file:/C:/mk/dev/git/base-pessoa-backend/src/main/java/main.dsl'
[INFO] Finished collecting source models. Took: 7 ms.
[INFO] Installing type provider.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.799 s
[INFO] Finished at: 2021-05-12T10:41:38-03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.eclipse.xtext:xtext-maven-plugin:2.25.0:generate (default) on project base-pessoa-backend: Execution default of goal org.eclipse.xtext:xtext-maven-plugin:2.25.0:generate failed: java.lang.IllegalStateException: Unresolved proxy classpath:/br/com/triersistemas/trierdsl/br.com.triersistemas.trierdsl.model#//DomainModel. Make sure the EPackage has been registered. -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.eclipse.xtext:xtext-maven-plugin:2.25.0:generate (default) on project base-pessoa-backend: Execution default of goal org.eclipse.xtext:xtext-maven-plugin:2.25.0:generate failed: java.lang.IllegalStateException: Unresolved proxy classpath:/br/com/triersistemas/trierdsl/br.com.triersistemas.trierdsl.model#//DomainModel. Make sure the EPackage has been registered.
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)

Re: My xtext-maven-plugin does not generate DSL code on project [message #1841333 is a reply to message #1841332] Wed, 12 May 2021 14:04 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14062
Registered: July 2009
Senior Member
if you use an external metamodel make sure it is registered
e.g. by patching standalonesetup


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: My xtext-maven-plugin does not generate DSL code on project [message #1841334 is a reply to message #1841333] Wed, 12 May 2021 14:13 Go to previous messageGo to next message
Márcio Koch is currently offline Márcio KochFriend
Messages: 54
Registered: August 2013
Member
Ok I understand, but could you please show some example how and where to do this?
Re: My xtext-maven-plugin does not generate DSL code on project [message #1841335 is a reply to message #1841334] Wed, 12 May 2021 14:41 Go to previous messageGo to next message
Márcio Koch is currently offline Márcio KochFriend
Messages: 54
Registered: August 2013
Member
Ok, the use of an external metamodel I solved:
/**
 * Initialization support for running Xtext languages without Equinox extension
 * registry.
 */
public class TrierDSLStandaloneSetup extends TrierDSLStandaloneSetupGenerated {

	@Override
	public void register(Injector injector) {
		if (!EPackage.Registry.INSTANCE.containsKey(ModelPackage.eNS_URI)) {
			EPackage.Registry.INSTANCE.put(ModelPackage.eNS_URI, ModelPackage.eINSTANCE);
		}

		super.register(injector);
	}

	public static void doSetup() {
		new TrierDSLStandaloneSetup().createInjectorAndDoEMFRegistration();
	}
}



But one more question, how can I stay the file main.dsl inside the root of my project and not in the src/main/java folder?
Re: My xtext-maven-plugin does not generate DSL code on project [message #1841337 is a reply to message #1841335] Wed, 12 May 2021 15:06 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14062
Registered: July 2009
Senior Member
Good question
I am not sure if this is possible
Maybe you can set the sourceRoots list


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: My xtext-maven-plugin does not generate DSL code on project [message #1841338 is a reply to message #1841337] Wed, 12 May 2021 15:08 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14062
Registered: July 2009
Senior Member
https://github.com/eclipse/xtext-maven/blob/master/org.eclipse.xtext.maven.plugin/src/main/java/org/eclipse/xtext/maven/XtextGenerateMojo.java
https://github.com/eclipse/xtext-maven/blob/0eef038ee0dcd9f175086e142520e97ebc623e8c/org.eclipse.xtext.maven.plugin/src/test/resources/it/generate/maven-config/pom.xml#L20


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Wed, 12 May 2021 16:13]

Report message to a moderator

Re: My xtext-maven-plugin does not generate DSL code on project [message #1841347 is a reply to message #1841338] Wed, 12 May 2021 18:18 Go to previous message
Márcio Koch is currently offline Márcio KochFriend
Messages: 54
Registered: August 2013
Member
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>
Previous Topic:Dockerizing Xtext web app
Next Topic:Update to Java 11 as minimal Java version
Goto Forum:
  


Current Time: Tue Sep 21 09:29:38 GMT 2021

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

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

Back to the top