Skip to main content



      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 09:59 Go to next message
Eclipse UserFriend
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.
Re: test of DSL does not run with maven [message #1691762 is a reply to message #1691760] Thu, 09 April 2015 10:07 Go to previous messageGo to next message
Eclipse UserFriend
how does your maven setup look like and how the debug output of the maven run?
Re: test of DSL does not run with maven [message #1691763 is a reply to message #1691762] Thu, 09 April 2015 10:16 Go to previous messageGo to next message
Eclipse UserFriend
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>


Re: test of DSL does not run with maven [message #1691764 is a reply to message #1691763] Thu, 09 April 2015 10:17 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

and how does your test look like?
Re: test of DSL does not run with maven [message #1691765 is a reply to message #1691764] Thu, 09 April 2015 10:23 Go to previous messageGo to next message
Eclipse UserFriend
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);

Re: test of DSL does not run with maven [message #1691766 is a reply to message #1691765] Thu, 09 April 2015 10:25 Go to previous messageGo to next message
Eclipse UserFriend
Hmmm,

that happens if you call setClasspathUriContext(this) on the resourceset before parsing?
Re: test of DSL does not run with maven [message #1691768 is a reply to message #1691766] Thu, 09 April 2015 10:30 Go to previous message
Eclipse UserFriend
changed to
	@Test 
	def void testParseString() {
		val resourceSet = resourceSetProvider.get
		resourceSet.classpathURIContext = this
		val testFacade = '''
package unittest
...


Now it works. Thanks!
Previous Topic:Xtext 2.8 pdf?
Next Topic:Why are optional dependencies in Xtext greedy?
Goto Forum:
  


Current Time: Sun Jul 13 14:51:24 EDT 2025

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

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

Back to the top