Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sapphire » Code Generation(Annotation Compiler)
Code Generation [message #715321] Sat, 13 August 2011 10:44 Go to next message
Kamesh Sampath is currently offline Kamesh Sampath
Messages: 213
Registered: July 2009
Senior Member
Hi,

I am having peculiar issue with Sapphire generating my model classes, i have enable the annotation processing for my Project and when I build the project i don't see any classes generated from my model , not sure what is the cause because there is no error trace too.

I putting down the snippet of my MANIFEST.MF

....
 org.eclipse.core.commands;visibility:=reexport,
 org.eclipse.emf.codegen;bundle-version="2.5.0",
 org.eclipse.emf.ecore;bundle-version="2.5.0",
 org.eclipse.jdt.core,
 org.eclipse.jem.util;bundle-version="2.0.201",
 org.eclipse.jem.workbench;bundle-version="2.0.201",
 org.eclipse.jface.text,
 org.eclipse.jst.j2ee;bundle-version="[1.1.301,2.0.0)",
 org.eclipse.jst.j2ee.core;bundle-version="[1.1.301,2.0.0)";visibility:=reexport,
 org.eclipse.jst.j2ee.web;bundle-version="[1.1.301,2.0.0)";visibility:=reexport,
 org.eclipse.wst.common.frameworks;bundle-version="[1.1.300,2.0.0)",
 org.eclipse.wst.common.project.facet.core;bundle-version="[1.4.1,2.0.0)",
 org.eclipse.wst.server.core;bundle-version="[1.1.102,2.0.0)",
 org.eclipse.wst.sse.core;bundle-version="[1.1.402,2.0.0)";visibility:=reexport,
 org.eclipse.wst.xml.core;bundle-version="[1.1.402,2.0.0)";visibility:=reexport,
 org.apache.commons.logging,
 org.eclipse.wst.validation;bundle-version="[1.2.104,1.3.0)",
 org.eclipse.sapphire.java;bundle-version="0.3.1",
 org.eclipse.sapphire.java.jdt;bundle-version="0.3.1",
 org.eclipse.sapphire.modeling;bundle-version="0.3.1",
 org.eclipse.sapphire.modeling.xml;bundle-version="0.3.1",
 org.eclipse.sapphire.osgi;bundle-version="0.3.1",
 org.eclipse.sapphire.platform;bundle-version="0.3.1",
 org.eclipse.sapphire.workspace;bundle-version="0.3.1"
....

Not sure if some other plugin is causing/preventing the code generation of Sapphire.

It works if I have only the sapphire model classes in a separate plugin.

Is there anyway to over come the issue, something like using Tycho/Ant to generate the classes at run-time/compile-time ?

[Updated on: Sun, 14 August 2011 08:37]

Report message to a moderator

Re: Code Generation [message #715376 is a reply to message #715321] Sat, 13 August 2011 16:38 Go to previous messageGo to next message
Kamesh Sampath is currently offline Kamesh Sampath
Messages: 213
Registered: July 2009
Senior Member
I followed the http://wiki.eclipse.org/Sapphire_Modeling_Tycho_build_support on using Tycho with my Plugin build, but when I try to integrate the the customCallbacks.xml to my maven build I get the following error ,

Quote:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.6:run (generate-sources) on project ${PLUGIN_NAME}: An Ant BuildException has occured: The following error occurred while executing this line:
[ERROR]${PLUGIN_SRC_FOLDER}\build-sapphire.xml:41: The following error occurred while executing this line:
[ERROR] ${PLUGIN_SRC_FOLDER}\build-sapphire.xml:65: The
following error occurred while executing this line:
[ERROR] ${PLUGIN_SRC_FOLDER}\build-sapphire.xml:92: No
suitable relative path from ${PLUGIN_SRC_FOLDER} to ${M2_REPO}\p2\osgi\bundle\org.eclipse.emf.ecore.change\2.7.0.v20110408-2116\org.eclipse.emf.ecore.change-2.7.0.v20110408-2116.jar


For brevity i have used


  • $PLUGIN_SRC_FOLDER- this corresponds to the Eclipse Plugin source folder in
  • $M2_REPO corresponds to the Local maven repository workspace
  • build-sapphire.xml --> customCallbacks.xml


My platform is on Windows 7 with Maven 3.0.3 and Eclipse Indigo, also I have turned off Annotation processing at the project settings to make the build free of any user specific settings.

I personally feel there is some interference with EMF and Sapphire and not sure they could be used in same project as dependencies and doubt the cause of my previous thread message could be this too ....

~Kamesh

[Updated on: Sun, 14 August 2011 08:37]

Report message to a moderator

Re: Code Generation [message #715761 is a reply to message #715376] Mon, 15 August 2011 12:29 Go to previous messageGo to next message
Kamesh Sampath is currently offline Kamesh Sampath
Messages: 213
Registered: July 2009
Senior Member
I was able to solve this issue ! I guess there is some issue with the Eclipse Annotation Processing (thinking ?????)

I tried to fork the Ant build with maven as mentioned above and that also failed due to some wired errors with respect to the Annotation processing, so thought to resort pure Maven way using the Maven Apt Plugin

My configuration is as follows,
<plugin>
	<groupId>org.codehaus.mojo</groupId>
	<artifactId>apt-maven-plugin</artifactId>
	<version>1.0-alpha-4</version>
	<inherited>true</inherited>
	<configuration>
		<fork>true</fork>
		<encoding>UTF-8</encoding>
		<factory>org.eclipse.sapphire.sdk.build.processor.internal.APFactory</factory>
		<sourceOutputDirectory>.apt_generated</sourceOutputDirectory>
		<outputDirectory>.apt_generated</outputDirectory>
		<meminitial>256m</meminitial>
		<maxmem>512m</maxmem>
	<!-- used for staleness checking -->
		<outputFileEndings>
			<outputFileEnding>.xml</outputFileEnding>
		</outputFileEndings>
	<!-- force skips stale checking and always generate -->
	<!-- force>true</force  -->
	</configuration>					
</plugin>


Now the code is getting generated with a warning as below,
Quote:

[WARNING] warning: Annotation types without processors: [org.eclipse.sapphire.modeling.annotations.Image, org.eclipse.sapphir
e.modeling.annotations.Type, org.eclipse.sapphire.modeling.xml.annotations.XmlListBinding.Mapping, org.eclipse.sapphire.model
ing.xml.annotations.XmlListBinding, org.eclipse.sapphire.modeling.annotations.Reference, org.eclipse.sapphire.java.JavaTypeCo
nstraint, org.eclipse.sapphire.modeling.annotations.NoDuplicates, org.eclipse.sapphire.modeling.xml.annotations.XmlBinding, o
rg.eclipse.sapphire.modeling.annotations.Whitespace, org.eclipse.sapphire.modeling.xml.annotations.CustomXmlValueBinding, org
.eclipse.sapphire.modeling.annotations.Service, org.eclipse.sapphire.modeling.annotations.Required, org.eclipse.sapphire.mode
ling.annotations.MustExist, org.eclipse.sapphire.modeling.annotations.CountConstraint, org.eclipse.sapphire.modeling.xml.anno
tations.CustomXmlElementBinding, java.lang.Override, org.eclipse.sapphire.modeling.annotations.EnumSerialization, java.lang.S
uppressWarnings, org.eclipse.sapphire.modeling.annotations.DefaultValue, org.eclipse.sapphire.modeling.annotations.PossibleVa
lues, org.eclipse.sapphire.modeling.xml.annotations.XmlValueBinding, org.eclipse.sapphire.modeling.annotations.DerivedValue,
org.eclipse.sapphire.modeling.annotations.Enablement, org.eclipse.sapphire.modeling.xml.annotations.XmlRootBinding, org.eclip
se.sapphire.modeling.annotations.Documentation]


Wondering what it is missing something from Maven Plugin class path ? or anything else and its implications .....


~Kamesh

[Updated on: Mon, 15 August 2011 12:30]

Report message to a moderator

Re: Code Generation [message #715821 is a reply to message #715761] Mon, 15 August 2011 16:52 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin Komissarchik
Messages: 940
Registered: July 2009
Senior Member
Don't know much about using Maven, but when it comes to annotation processing in Eclipse, I have seen problems with annotation processor not being invoked on some projects when the number of projects requiring annotation processing is high. I have always been able to resolve this issue by closing the projects that I am not working on at the moment. So... keep your workspace light and you shouldn't have any issues.

- Konstantin
Re: Code Generation [message #715846 is a reply to message #715821] Mon, 15 August 2011 18:16 Go to previous messageGo to next message
Kamesh Sampath is currently offline Kamesh Sampath
Messages: 213
Registered: July 2009
Senior Member
yeah thanks for the thought ! but wanted to post it here so that someone trying for the solution use it .
Re: Code Generation [message #718133 is a reply to message #715846] Tue, 23 August 2011 11:18 Go to previous messageGo to next message
Kamesh Sampath is currently offline Kamesh Sampath
Messages: 213
Registered: July 2009
Senior Member
I am getting a new and consistent error when using the Eclipse APT compiler or using the Ant build.xml (customCallbacks.xml), i either get

  [apt] Compiling 98 source files to /home/.../eclipse/.../plugins/...../.apt_generated
      [apt] Since compiler setting isn't classic or modern, ignoring fork setting.
      [apt] An exception has occurred in apt (1.6.0_22). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport)  after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report.  Thank you.
      [apt] java.lang.ClassCastException: com.sun.tools.javac.tree.JCTree$JCLiteral cannot be cast to com.sun.tools.javac.tree.JCTree$JCAnnotation
      [apt] at com.sun.tools.javac.comp.Annotate.enterAttributeValue(Annotate.java:219)
      [apt] at com.sun.tools.javac.comp.Annotate.enterAttributeValue(Annotate.java:233)
      [apt] at com.sun.tools.javac.comp.Annotate.enterAnnotation(Annotate.java:181)
      [apt] at com.sun.tools.javac.comp.MemberEnter.enterAnnotations(MemberEnter.java:755)
      [apt] at com.sun.tools.javac.comp.MemberEnter.access$300(MemberEnter.java:56)
      [apt] at com.sun.tools.javac.comp.MemberEnter$5.enterAnnotation(MemberEnter.java:723)
      [apt] at com.sun.tools.javac.comp.Annotate.flush(Annotate.java:109)
      [apt] at com.sun.tools.javac.comp.Annotate.enterDone(Annotate.java:101)
      [apt] at com.sun.tools.javac.comp.Enter.complete(Enter.java:502)
      [apt] at com.sun.tools.javac.comp.Enter.main(Enter.java:459)
      [apt] at com.sun.tools.apt.main.JavaCompiler.compile(JavaCompiler.java:264)
      [apt] at com.sun.tools.apt.main.Main.compile(Main.java:1121)
      [apt] at com.sun.tools.apt.main.Main.compile(Main.java:983)
      [apt] at com.sun.tools.apt.Main.processing(Main.java:113)
      [apt] at com.sun.tools.apt.Main.process(Main.java:61)
      [apt] at com.sun.tools.apt.Main.main(Main.java:52)



OR

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.6:run (generate-sources) on project com.liferay
.ide.eclipse.portlet.core: An Ant BuildException has occured: The following error occurred while executing this line:
[ERROR] E:\liferay\sources\liferay-ide\eclipse\portal\plugins\com.liferay.ide.eclipse.portlet.core\build-sapphire.xml:43: The
 following error occurred while executing this line:
[ERROR] E:\liferay\sources\liferay-ide\eclipse\portal\plugins\com.liferay.ide.eclipse.portlet.core\build-sapphire.xml:85: The
 following error occurred while executing this line:
[ERROR] E:\liferay\sources\liferay-ide\eclipse\portal\plugins\com.liferay.ide.eclipse.portlet.core\build-sapphire.xml:121: No
 suitable relative path from E:\liferay\sources\liferay-ide\eclipse\portal\plugins\com.liferay.ide.eclipse.portlet.core to C:
\Users\kamesh\.m2\repository\ant-contrib\ant-contrib\1.0b3\ant-contrib-1.0b3.jar


Not sure whats going wrong, is it Eclipse Annotation processor crashing it or Sapphire Annotation Processor crashing it.

~Kamesh
Re: Code Generation [message #718246 is a reply to message #715321] Tue, 23 August 2011 17:55 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin Komissarchik
Messages: 940
Registered: July 2009
Senior Member
The first issue is definitely a bug in Javac/APT. This crash happens before it gets to Sapphire processor. This looks similar a bug that I've seen before. Try the resolution described here...

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6670278

The second one looks like some sort of a Maven issue. There isn't anything Sapphire related there and I cannot help you with Maven.

- Konstantin
Re: Code Generation [message #718247 is a reply to message #718246] Tue, 23 August 2011 17:58 Go to previous message
Kamesh Sampath is currently offline Kamesh Sampath
Messages: 213
Registered: July 2009
Senior Member
that's fine with the maven error, i can kind of figure it out just wanted to throw out the errors that am getting.
Previous Topic:Custom Validation Service
Next Topic:Filtered Tree
Goto Forum:
  


Current Time: Sat Sep 20 20:23:09 GMT 2014

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

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