#12
Building with Ant
Oct 06, 2012 |
10 minutes |
Build
In this episode I show how to build a standard Xtext project with an Ant.
- Download:
-
source code
Project Files in Zip (20.9 MB)
-
mp4
Full Size H.264 Video (26.7 MB)
-
m4v
Smaller H.264 Video (15.3 MB)
-
webm
Full Size VP8 Video (16.4 MB)
-
ogv
Full Size Theora Video (39.9 MB)
Nice! Any chance of creating a maven version as well?
Yes, it will come :-)
The build with maven is pretty good documented already. Most open source projects (like Jnario and Xtext itself) use it. So, I decided to start with the Ant build.
Meanwhile, you could also take a look at this:
https://github.com/aphethean/xtext-maven-examples
Hi. Generate artifacts works great. However, I'm unable to compile the xtend classes.
ERROR DeclaredTypeFactory - Incomplete nested types for org.eclipse.emf.common.util.BasicDiagnostic: java.lang.NoClassDefFoundError: org/eclipse/core/runtime/IStatus
I used the jar in my eclipse folder: org.eclipse.core.runtime_3.7.0.v20110110.jar and added it to the libs folder. But I noticed that that jar doesn't contain IStatus
Any hints are highly appreciated :)
(great video btw!)
Solved it. IStatus is in the org.eclipse.equinox.common jar
Hi,
I use following command to find jars with required classes:
Works on Linux/Mac or on MinGW/Cygwin on Windows
Hi.
The video was good, it helped me much.
Generate artifacts works great. However, I'm unable to compile the xtend classes, I am getting the following error.
compile-xtend:
[java] Exception in thread "main" java.lang.NoClassDefFoundError: org/objectweb/asm/ClassVisitor
[java] at java.lang.ClassLoader.defineClass1(Native Method)
[java] at java.lang.ClassLoader.defineClass(Unknown Source)
[java] at java.security.SecureClassLoader.defineClass(Unknown Source)
[java] at java.net.URLClassLoader.defineClass(Unknown Source)
[java] at java.net.URLClassLoader.access$100(Unknown Source)
[java] at java.net.URLClassLoader$1.run(Unknown Source)
[java] at java.net.URLClassLoader$1.run(Unknown Source)
[java] at java.security.AccessController.doPrivileged(Native Method)
[java] at java.net.URLClassLoader.findClass(Unknown Source)
[java] at java.lang.ClassLoader.loadClass(Unknown Source)
[java] at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
[java] at java.lang.ClassLoader.loadClass(Unknown Source)
[java] at org.eclipse.xtext.common.types.access.impl.DeclaredTypeFactory.doCreateType(DeclaredTypeFactory.java:72)
[java] at org.eclipse.xtext.common.types.access.impl.DeclaredTypeFactory.createType(DeclaredTypeFactory.java:62)
[java] at org.eclipse.xtext.common.types.access.impl.DeclaredTypeFactory.createType(DeclaredTypeFactory.java:1)
[java] at org.eclipse.xtext.common.types.access.binary.BinaryClassMirror.initialize(BinaryClassMirror.java:41)
[java] at org.eclipse.xtext.common.types.access.TypeResource.doLoad(TypeResource.java:115)
[java] at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1518)
[java] at org.eclipse.xtext.common.types.access.TypeResource.load(TypeResource.java:102)
[java] at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:259)
[java] at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274)
[java] at org.eclipse.xtext.resource.XtextResourceSet.getResource(XtextResourceSet.java:201)
[java] at org.eclipse.xtext.resource.SynchronizedXtextResourceSet.getResource(SynchronizedXtextResourceSet.java:26)
[java] at org.eclipse.xtext.common.types.access.impl.ClasspathTypeProvider.findTypeByClass(ClasspathTypeProvider.java:212)
[java] at org.eclipse.xtext.common.types.access.impl.ClasspathTypeProvider.findTypeByName(ClasspathTypeProvider.java:168)
[java] at org.eclipse.xtext.common.types.access.impl.ClasspathTypeProvider.findTypeByName(ClasspathTypeProvider.java:187)
[java] at org.eclipse.xtext.common.types.xtext.AbstractTypeScope.getSingleElement(AbstractTypeScope.java:60)
[java] at org.eclipse.xtend.core.scoping.RecordingTypeScope.getSingleElement(RecordingTypeScope.java:35)
[java] at org.eclipse.xtend.core.scoping.TypeScopeWithWildcardImports.getSingleElement(TypeScopeWithWildcardImports.java:52)
[java] at org.eclipse.xtend.core.scoping.KnownTypesScope.getSingleElement(KnownTypesScope.java:40)
[java] at org.eclipse.xtend.core.scoping.PrimitiveAwareScope.getSingleElement(PrimitiveAwareScope.java:39)
[java] at org.eclipse.xtend.core.scoping.CachingTypeScope.getSingleElement(CachingTypeScope.java:40)
[java] at org.eclipse.xtext.linking.impl.DefaultLinkingService.getLinkedObjects(DefaultLinkingService.java:120)
[java] at org.eclipse.xtext.linking.lazy.LazyLinkingResource.getEObject(LazyLinkingResource.java:228)
[java] at org.eclipse.xtext.xbase.resource.BatchLinkableResource.getEObject(BatchLinkableResource.java:105)
[java] at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getEObject(ResourceSetImpl.java:223)
[java] at org.eclipse.emf.ecore.util.EcoreUtil.resolve(EcoreUtil.java:198)
[java] at org.eclipse.emf.ecore.util.EcoreUtil.resolve(EcoreUtil.java:258)
[java] at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eResolveProxy(BasicEObjectImpl.java:1473)
[java] at org.eclipse.xtext.common.types.impl.JvmTypeReferenceImplCustom.eResolveProxy(JvmTypeReferenceImplCustom.java:37)
[java] at org.eclipse.xtext.common.types.impl.JvmParameterizedTypeReferenceImpl.getType(JvmParameterizedTypeReferenceImpl.java:112)
[java] at org.eclipse.xtend.core.jvmmodel.XtendJvmModelInferrer.initialize(XtendJvmModelInferrer.java:301)
[java] at org.eclipse.xtend.core.jvmmodel.XtendJvmModelInferrer$3.run(XtendJvmModelInferrer.java:174)
[java] at org.eclipse.xtend.core.jvmmodel.XtendJvmModelInferrer.infer(XtendJvmModelInferrer.java:229)
[java] at org.eclipse.xtext.xbase.jvmmodel.JvmModelAssociator.installDerivedState(JvmModelAssociator.java:302)
[java] at org.eclipse.xtext.resource.DerivedStateAwareResource.installDerivedState(DerivedStateAwareResource.java:145)
[java] at org.eclipse.xtext.xbase.resource.BatchLinkableResource.getContents(BatchLinkableResource.java:130)
[java] at org.eclipse.emf.ecore.util.EcoreUtil.resolveAll(EcoreUtil.java:280)
[java] at org.eclipse.emf.ecore.util.EcoreUtil.resolveAll(EcoreUtil.java:270)
[java] at org.eclipse.xtend.core.compiler.batch.XtendBatchCompiler.compile(XtendBatchCompiler.java:392)
[java] at org.eclipse.xtend.core.compiler.batch.Main.main(Main.java:55)
[java] Caused by: java.lang.ClassNotFoundException: org.objectweb.asm.ClassVisitor
[java] at java.net.URLClassLoader$1.run(Unknown Source)
[java] at java.net.URLClassLoader$1.run(Unknown Source)
[java] at java.security.AccessController.doPrivileged(Native Method)
[java] at java.net.URLClassLoader.findClass(Unknown Source)
[java] at java.lang.ClassLoader.loadClass(Unknown Source)
[java] at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
[java] at java.lang.ClassLoader.loadClass(Unknown Source)
[java] ... 51 more
Yes, starting with Xtext 2.5.0 you need a new dependency:
Just add the new jar to your build process.
Hi Boris,
Thanks for quick Reply,It worked for me and i am able to compile them. I just need one more help from you, I just want to make plugins out of this compiled classes, how to proceed on this.
Thanks
Hello,
this isn't that easy and it wasn't topic of the screencast. You have to configure and run eclipse in headless mode using eclipse compiler and export routines.
Hi Boris,
When I compile them , the error "XXXX cannot resolved to a type" will occur. And "XXXX" was a class auto generated by emf model. So I cannot compile successful.
Thanks
Hi Boris,
When I compile them , the error "XXXX cannot resolved to a type" will occur. And "XXXX" was a class auto generated by emf model. So I cannot compile successful.
Thanks
First sign in through GitHub to post a comment.