Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Building XText Projects with Maven Sample
Building XText Projects with Maven Sample [message #675778] Wed, 01 June 2011 13:32 Go to next message
Andreas   is currently offline Andreas Friend
Messages: 8
Registered: April 2011
Junior Member
Hi,

i was already able to successfully configure an maven build for my xtext projects. So tycho and the oaw plugins are used to compile everything. I am also using the default maven folder structure (src/main/java,src/main/resources,src/generated/java). The build is running fine on my local machine and as well on other developer systems. The only issue we have is that the build doesn't work on our hudson. I already figured out that the packages and classes with my language name are not getting generated.

As this issue is quite hard to analyze i would like to know whether someone has already configured such an build and could provide the details (linkt to versioning system and the link to the hudson buildserver), so that i could compare it with my setup.

That would be really helpful for me.

Andreas

[Updated on: Wed, 01 June 2011 13:37]

Report message to a moderator

Re: Building XText Projects with Maven Sample [message #676796 is a reply to message #675778] Mon, 06 June 2011 14:47 Go to previous messageGo to next message
Adrian  is currently offline Adrian Friend
Messages: 1
Registered: June 2011
Junior Member
Hello Andreas,

how have you managed to let your code be generated using tycho?

We stuck at

[ERROR] java.lang.RuntimeException: Cannot create a resource for 'D:\path\transform.mwe2'; a registered resource factory is needed


Thanks Adrian
Re: Building XText Projects with Maven Sample [message #676835 is a reply to message #676796] Mon, 06 June 2011 16:58 Go to previous messageGo to next message
Andreas   is currently offline Andreas Friend
Messages: 8
Registered: April 2011
Junior Member
Hi Adrian,

her are my mwe2 file and my pom:

module org.example.editor.script.TestScriptDSL

import org.eclipse.emf.mwe.utils.*
import org.eclipse.xtext.generator.*
import org.eclipse.xtext.ui.generator.*

var grammarURI = "classpath:/org/example/editor/script/TestScriptDSL.xtext"
var file.extensions = "tos"
var projectName = "org.example.editor.script"
var runtimeProject = "../${projectName}"
var project.build.sourceDirectory = "src/main/java"
var project.build.generatedSourceDirectory = "target/generated/java"

Workflow {
	bean = StandaloneSetup {
		platformUri = "${runtimeProject}/.."
	}

	component = DirectoryCleaner {
		directory = "${runtimeProject}/${project.build.generatedSourceDirectory}"
	}

	component = DirectoryCleaner {
		directory = "${runtimeProject}.ui/${project.build.generatedSourceDirectory}"
	}

	component = Generator {
		pathRtProject = runtimeProject
		pathUiProject = "${runtimeProject}.ui"
		projectNameRt = projectName
		projectNameUi = "${projectName}.ui"
		srcPath = "/${project.build.sourceDirectory}"
		srcGenPath = "/${project.build.generatedSourceDirectory}"
		language = {
			uri = grammarURI
			fileExtensions = file.extensions

			// Java API to access grammar elements (required by several other fragments)
			fragment = grammarAccess.GrammarAccessFragment {}

			// generates Java API for the generated EPackages 
			fragment = ecore.EcoreGeneratorFragment {
				referencedGenModels = "classpath:/model/JavaVMTypes.genmodel"
			}

			// the serialization component
			fragment = parseTreeConstructor.ParseTreeConstructorFragment {}

			// a custom ResourceFactory for use with EMF 
			fragment = resourceFactory.ResourceFactoryFragment {
				fileExtensions = file.extensions
			}

			// The antlr parser generator fragment.
			fragment = parser.antlr.XtextAntlrGeneratorFragment {
			//  options = {
			//		backtrack = true
			//	}
			}

			// java-based API for validation 
			fragment = validation.JavaValidatorFragment {
				composedCheck = "org.eclipse.xtext.validation.ImportUriValidator"
				composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"// registerForImportedPackages = true
			}

			// scoping and exporting API
			// fragment = scoping.ImportURIScopingFragment {}
			// fragment = exporting.SimpleNamesFragment {}

			// scoping and exporting API 
			fragment = scoping.ImportNamespacesScopingFragment {}
			fragment = exporting.QualifiedNamesFragment {}
			fragment = builder.BuilderIntegrationFragment {}
			fragment = types.TypesGeneratorFragment {}
			

			// formatter API 
			fragment = formatting.FormatterFragment {}

			// labeling API 
			fragment = labeling.LabelProviderFragment {}

			// outline API 
			fragment = outline.TransformerFragment {}
			fragment = outline.OutlineNodeAdapterFactoryFragment {}
			fragment = outline.QuickOutlineFragment {}

			// quickfix API 
			fragment = quickfix.QuickfixProviderFragment {}

			// content assist API  
			fragment = contentAssist.JavaBasedContentAssistFragment {}

			// generates a more lightweight Antlr parser and lexer tailored for content assist  
			fragment = parser.antlr.XtextAntlrUiGeneratorFragment {}

			// project wizard (optional) 
			// fragment = projectWizard.SimpleProjectWizardFragment {
			// 		generatorProjectName = "${projectName}.generator" 
			//		modelFileExtension = file.extensions
			// }
		}
	}
}


<?xml version="1.0" encoding="UTF-8"?>
<project>
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>org.example.editor</groupId>
		<artifactId>org.example.editor</artifactId>
		<version>1.0.0</version>
	</parent>
	<artifactId>org.example.editor.script</artifactId>
	<packaging>eclipse-plugin</packaging>

	<build>
		<resources>
			<resource>
				<directory>src/main/java</directory>
			</resource>
			<resource>
				<directory>src/main/resources</directory>
			</resource>
			<resource>
				<directory>target/generated/java</directory>
			</resource>
		</resources>

		<plugins>
			<plugin>
				<artifactId>maven-clean-plugin</artifactId>
				<configuration>
					<filesets>
						<fileset>
							<directory>../org.example.editor.locator.ui</directory>
							<includes>
								<include>${project.build.directory}</include>
							</includes>
						</fileset>
					</filesets>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.fornax.toolsupport</groupId>
				<artifactId>fornax-oaw-m2-plugin</artifactId>
				<configuration>
					<workflowDescriptor>src/main/resources/org/example/editor/script/GenerateTestScriptDSL.mwe2</workflowDescriptor>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>
Re: Building XText Projects with Maven Sample [message #687798 is a reply to message #675778] Thu, 23 June 2011 08:53 Go to previous messageGo to next message
Sebastian Paul is currently offline Sebastian PaulFriend
Messages: 106
Registered: July 2009
Senior Member
Hi,
I am using maven-antrun-plugin instead of Fornax. The approach is
described at
http://www.sigasi.com/content/building-xtext-20-projects-maven-tycho. It
claims to work with Xtext 2.0, but be we use it for 1.0.1 with success.
The only drawback is that the build does not fail when the MWE2
execution fails, e.g OutOfMemoryError when maxmemory has not been set
high enough for the java Ant task. The build fails later when the
compiler misses some types, so it is a bit hard to find the real cause
in the log.

Am 2011-06-01 15:32, schrieb Andreas:
> Hi,
>
> i was already able to successfully configure an maven build for my xtext
> projects. So tycho and the oaw plugins are used to compile everything.


--
Best regards,
Sebastian Paul
Re: Building XText Projects with Maven Sample [message #687800 is a reply to message #675778] Thu, 23 June 2011 08:53 Go to previous messageGo to next message
Sebastian Paul is currently offline Sebastian PaulFriend
Messages: 106
Registered: July 2009
Senior Member
Hi,
I am using maven-antrun-plugin instead of Fornax. The approach is
described at
http://www.sigasi.com/content/building-xtext-20-projects-maven-tycho. It
claims to work with Xtext 2.0, but be we use it for 1.0.1 with success.
The only drawback is that the build does not fail when the MWE2
execution fails, e.g OutOfMemoryError when maxmemory has not been set
high enough for the java Ant task. The build fails later when the
compiler misses some types, so it is a bit hard to find the real cause
in the log.

Am 2011-06-01 15:32, schrieb Andreas:
> Hi,
>
> i was already able to successfully configure an maven build for my xtext
> projects. So tycho and the oaw plugins are used to compile everything.


--
Best regards,
Sebastian Paul
Re: Building XText Projects with Maven Sample [message #687802 is a reply to message #675778] Thu, 23 June 2011 08:53 Go to previous messageGo to next message
Sebastian Paul is currently offline Sebastian PaulFriend
Messages: 106
Registered: July 2009
Senior Member
Hi,
I am using maven-antrun-plugin instead of Fornax. The approach is
described at
http://www.sigasi.com/content/building-xtext-20-projects-maven-tycho. It
claims to work with Xtext 2.0, but be we use it for 1.0.1 with success.
The only drawback is that the build does not fail when the MWE2
execution fails, e.g OutOfMemoryError when maxmemory has not been set
high enough for the java Ant task. The build fails later when the
compiler misses some types, so it is a bit hard to find the real cause
in the log.

Am 2011-06-01 15:32, schrieb Andreas:
> Hi,
>
> i was already able to successfully configure an maven build for my xtext
> projects. So tycho and the oaw plugins are used to compile everything.


--
Best regards,
Sebastian Paul
Re: Building XText Projects with Maven Sample [message #687805 is a reply to message #687800] Thu, 23 June 2011 09:15 Go to previous message
Andreas   is currently offline Andreas Friend
Messages: 8
Registered: April 2011
Junior Member
Hi Sebastian,

thanks for your hint, i was finally able to get the build running with the fornax plugin. The main issue was that the mwe worklflow needs a proper .project file. This wasn't the case because we do not submit those files to our svn.

Currently i am using the maven copy and replace plugin to generate this file at build time.

Regards

Andreas
Previous Topic:Xtend: generate source from multiple resources
Next Topic:0.0.7 to 2.0.0
Goto Forum:
  


Current Time: Fri Apr 19 19:38:35 GMT 2024

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

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

Back to the top