Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » test of DSL does not run with maven(Couldn't resolve reference to JvmType 'TestEnum')
test of DSL does not run with maven [message #1691760] Thu, 09 April 2015 13:59 Go to next message
peter luthardt is currently offline peter luthardtFriend
Messages: 22
Registered: March 2014
Junior Member
In my testcase I parse a DSL-text where I refer to an Enumeration wich is defined in the same package as the testCase.
src/com/lutte/test/TestCase.xtend
src/com/lutte/test/TestEnum.java

import java.util.List
import java.util.LinkedHashMap
import com.lutte.test.TestEnum

When I run the test in eclipse everything works fine, But when I buil with maven the build fails as the text could not be parsed
issue: Couldn't resolve reference to JvmType 'TestEnum'.
issue: Couldn't resolve reference to JvmDeclaredType 'com.lutte.test.TestEnum'.

It seems that this es a class path issue but I have no idea where to start.

When I remove the import of the Enumeration the build does not fail.


Xtext 2.8.1
Re: test of DSL does not run with maven [message #1691762 is a reply to message #1691760] Thu, 09 April 2015 14:07 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
how does your maven setup look like and how the debug output of the maven run?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: test of DSL does not run with maven [message #1691763 is a reply to message #1691762] Thu, 09 April 2015 14:16 Go to previous messageGo to next message
peter luthardt is currently offline peter luthardtFriend
Messages: 22
Registered: March 2014
Junior Member
Thanks for your fast reply. I hope this is what you need
pom.xml
	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-deploy-plugin</artifactId>
				<version>2.7</version>
				<configuration>
					<skip>true</skip>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.eclipse.xtend</groupId>
				<artifactId>xtend-maven-plugin</artifactId>
			</plugin>
			<plugin>
				<groupId>org.eclipse.tycho</groupId>
				<artifactId>tycho-surefire-plugin</artifactId>
				<version>${tycho-version}</version>
				<configuration>
					<failIfNoTests>false</failIfNoTests>
				</configuration>
			</plugin>

		</plugins>
	</build>




Xtext 2.8.1
Re: test of DSL does not run with maven [message #1691764 is a reply to message #1691763] Thu, 09 April 2015 14:17 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

and how does your test look like?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: test of DSL does not run with maven [message #1691765 is a reply to message #1691764] Thu, 09 April 2015 14:23 Go to previous messageGo to next message
peter luthardt is currently offline peter luthardtFriend
Messages: 22
Registered: March 2014
Junior Member
Quote:

@RunWith(XtextRunner)
@InjectWith(TimDSLInjectorProvider)
class DefaultTest {

@Inject
extension ParseHelper<Model>
@Inject
extension ValidationTestHelper
@Inject
TimDSLGenerator ilfGenerator
@Inject
private Provider<XtextResourceSet> resourceSetProvider;

@Test
def void testParseString() {
val resourceSet = resourceSetProvider.get
val testFacade = '''
package unittest

import java.util.List
import java.util.LinkedHashMap
import com.lutte.test.TestEnum

....

'''.parse(URI.createURI("unittest/TIMdef.tim"), resourceSet)
val issues = testFacade.validate
issues.forEach[issue|
println ("issue: "+issue.message)
]
assertEquals (0, issues.size);



Xtext 2.8.1
Re: test of DSL does not run with maven [message #1691766 is a reply to message #1691765] Thu, 09 April 2015 14:25 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hmmm,

that happens if you call setClasspathUriContext(this) on the resourceset before parsing?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: test of DSL does not run with maven [message #1691768 is a reply to message #1691766] Thu, 09 April 2015 14:30 Go to previous message
peter luthardt is currently offline peter luthardtFriend
Messages: 22
Registered: March 2014
Junior Member
changed to
	@Test 
	def void testParseString() {
		val resourceSet = resourceSetProvider.get
		resourceSet.classpathURIContext = this
		val testFacade = '''
package unittest
...


Now it works. Thanks!


Xtext 2.8.1
Previous Topic:Xtext 2.8 pdf?
Next Topic:Why are optional dependencies in Xtext greedy?
Goto Forum:
  


Current Time: Thu Apr 18 08:23:30 GMT 2024

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

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

Back to the top