Set up Java Development Environment for CZT (Community Z Tool) On Windows
Windows
Install JDK-1.7.0
- Install Directory
- c:\Program Files\Java\jdk1.7.0_03
- c:\Program Files\Java\jre7
- Set environment variables
- Path=c:\Program Files\Java\jdk1.7.0_03\bin\;c:\Program Files\Java\jre7\bin\;
- JAVA_HOME=c:\Program Files\Java\jre7\
Install maven-3.0.5 (>= 3.0.4)
- Download maven for Windows from http://maven.apache.org/download.cgi
- Unpack the tar package under d:\programs
- Add maven bin to environment variable PATH
- PATH=d:\randall\Programs\apache-maven-3.0.5\bin\
Git clone czt code
git clone git://git.code.sf.net/p/czt/code czt_code
Build CZT
Build Error
- Compilation Error #1
------- Error Log ------
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] Unable to locate the Javac Compiler in:
c:\Program Files\Java\jre7\..\lib\tools.jar
Please ensure you are using JDK 1.4 or above and
not a JRE (the com.sun.tools.javac.Main class is required).
In most cases you can change the location of your Java
installation by setting the JAVA_HOME environment variable.
[INFO] 1 error
[INFO] -------------------------------------------------------------
Solution: change JAVA_HOME
to c:\Program Files\Java\jdk1.7.0_03\
- Build failed
Line breaks (Windows only)
On Windows, CZT expects Windows-style line breaks (CR+LF). The conversion is usually set by default (e.g. using msysgit) and nothing else is necessary. If, however, you encounter build problems with some CZT modules, try forcing the Windows line breaks using the following Git command in your repository:
git config core.autocrlf true
Then reset your Git repository to checkout correct line breaks:
git rm --cached -r .
git reset --hard
- Build Error
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7:23.874s
[INFO] Finished at: Tue Apr 23 10:45:24 BST 2013
[INFO] Final Memory: 291M/784M
[INFO] ------------------------------------------------------------------------
[INFO] Scanning for projects...
[WARNING] Error initializing: org.eclipse.tycho.p2.resolver.P2TargetPlatformReso lver@646d5273
java.lang.RuntimeException: java.lang.IllegalStateException: Service is not regi
stered class='interface org.eclipse.tycho.core.facade.ProxyServiceFacade'
at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.che
ckStarted(DefaultEquinoxEmbedder.java:301)
at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.get
Service(DefaultEquinoxEmbedder.java:275)
at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.get
Service(DefaultEquinoxEmbedder.java:270)
at org.eclipse.tycho.p2.resolver.P2TargetPlatformResolver.initialize(P2T
argetPlatformResolver.java:433)
at org.sonatype.guice.plexus.lifecycles.PlexusLifecycleManager.initializ
e(PlexusLifecycleManager.java:338)
at org.sonatype.guice.plexus.lifecycles.PlexusLifecycleManager.manageLif
ecycle(PlexusLifecycleManager.java:296)
at org.sonatype.guice.plexus.lifecycles.PlexusLifecycleManager.onProvisi
on(PlexusLifecycleManager.java:148)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.p
rovision(ProvisionListenerStackCallback.java:108)
at com.google.inject.internal.ProvisionListenerStackCallback.provision(P
rovisionListenerStackCallback.java:55)
at com.google.inject.internal.ProviderInternalFactory.circularGet(Provid
erInternalFactory.java:68)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(
InternalFactoryToInitializableAdapter.java:45)
at com.google.inject.internal.InjectorImpl$3$1.call(InjectorImpl.java:96
5)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.ja
va:1011)
at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:961)
at com.google.inject.Scopes$1$1.get(Scopes.java:59)
at org.sonatype.guice.bean.locators.LazyBeanEntry.getValue(LazyBeanEntry
.java:83)
at org.sonatype.guice.plexus.locators.LazyPlexusBean.getValue(LazyPlexus
Bean.java:49)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContai
ner.java:253)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContai
ner.java:245)
at org.eclipse.tycho.core.resolver.DefaultTargetPlatformResolverFactory.
lookupPlatformResolver(DefaultTargetPlatformResolverFactory.java:74)
at org.eclipse.tycho.core.resolver.DefaultTychoDependencyResolver.setupP
roject(DefaultTychoDependencyResolver.java:86)
at org.eclipse.tycho.core.maven.TychoMavenLifecycleParticipant.afterProj
ectsRead(TychoMavenLifecycleParticipant.java:77)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:274)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
cher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
a:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
uncher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
352)
Caused by: java.lang.IllegalStateException: Service is not registered class='int
erface org.eclipse.tycho.core.facade.ProxyServiceFacade'
at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.get
Service(DefaultEquinoxEmbedder.java:291)
at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.get
Service(DefaultEquinoxEmbedder.java:270)
at org.eclipse.tycho.osgi.configuration.OSGiProxyConfigurator.afterFrame
workStarted(OSGiProxyConfigurator.java:30)
at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.doS
tart(DefaultEquinoxEmbedder.java:180)
at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.sta
rt(DefaultEquinoxEmbedder.java:67)
at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.che
ckStarted(DefaultEquinoxEmbedder.java:299)
... 34 more
[ERROR] Internal error: java.lang.RuntimeException: Could not instantiate requir
ed component: com.google.inject.ProvisionException: Guice provision errors:
[ERROR]
[ERROR] 1) Error notifying ProvisionListener org.sonatype.guice.plexus.lifecycle
s.PlexusLifecycleManager of org.eclipse.tycho.core.TargetPlatformResolver annota
ted with @com.google.inject.name.Named(value=p2).
[ERROR] Reason: java.lang.RuntimeException: java.lang.IllegalStateException: Ser
vice is not registered class='interface org.eclipse.tycho.core.facade.ProxyServi
ceFacade'
[ERROR] while locating org.eclipse.tycho.core.TargetPlatformResolver annotated w
ith @com.google.inject.name.Named(value=p2)
[ERROR]
[ERROR] 1 error
[ERROR] role: org.eclipse.tycho.core.TargetPlatformResolver
[ERROR] roleHint: p2
[ERROR] -> [Help 1]
org.apache.maven.InternalErrorException: Internal error: java.lang.RuntimeExcept
ion: Could not instantiate required component
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:168)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
cher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
a:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
uncher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
352)
Caused by: java.lang.RuntimeException: Could not instantiate required component
at org.eclipse.tycho.core.resolver.DefaultTargetPlatformResolverFactory.
lookupPlatformResolver(DefaultTargetPlatformResolverFactory.java:76)
at org.eclipse.tycho.core.resolver.DefaultTychoDependencyResolver.setupP
roject(DefaultTychoDependencyResolver.java:86)
at org.eclipse.tycho.core.maven.TychoMavenLifecycleParticipant.afterProj
ectsRead(TychoMavenLifecycleParticipant.java:77)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:274)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
... 11 more
Caused by: org.codehaus.plexus.component.repository.exception.ComponentLookupExc
eption: com.google.inject.ProvisionException: Guice provision errors:
1) Error notifying ProvisionListener org.sonatype.guice.plexus.lifecycles.Plexus
LifecycleManager of org.eclipse.tycho.core.TargetPlatformResolver annotated with
@com.google.inject.name.Named(value=p2).
Reason: java.lang.RuntimeException: java.lang.IllegalStateException: Service is
not registered class='interface org.eclipse.tycho.core.facade.ProxyServiceFacad
e'
while locating org.eclipse.tycho.core.TargetPlatformResolver annotated with @c
om.google.inject.name.Named(value=p2)
1 error
role: org.eclipse.tycho.core.TargetPlatformResolver
roleHint: p2
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContai
ner.java:257)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContai
ner.java:245)
at org.eclipse.tycho.core.resolver.DefaultTargetPlatformResolverFactory.
lookupPlatformResolver(DefaultTargetPlatformResolverFactory.java:74)
... 15 more
Caused by: com.google.inject.ProvisionException: Guice provision errors:
1) Error notifying ProvisionListener org.sonatype.guice.plexus.lifecycles.Plexus
LifecycleManager of org.eclipse.tycho.core.TargetPlatformResolver annotated with
@com.google.inject.name.Named(value=p2).
Reason: java.lang.RuntimeException: java.lang.IllegalStateException: Service is
not registered class='interface org.eclipse.tycho.core.facade.ProxyServiceFacad
e'
while locating org.eclipse.tycho.core.TargetPlatformResolver annotated with @c
om.google.inject.name.Named(value=p2)
1 error
at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:974)
at com.google.inject.Scopes$1$1.get(Scopes.java:59)
at org.sonatype.guice.bean.locators.LazyBeanEntry.getValue(LazyBeanEntry
.java:83)
at org.sonatype.guice.plexus.locators.LazyPlexusBean.getValue(LazyPlexus
Bean.java:49)
at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContai
ner.java:253)
... 17 more
Caused by: java.lang.RuntimeException: java.lang.IllegalStateException: Service
is not registered class='interface org.eclipse.tycho.core.facade.ProxyServiceFac
ade'
at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.che
ckStarted(DefaultEquinoxEmbedder.java:301)
at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.get
Service(DefaultEquinoxEmbedder.java:275)
at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.get
Service(DefaultEquinoxEmbedder.java:270)
at org.eclipse.tycho.p2.resolver.P2TargetPlatformResolver.initialize(P2T
argetPlatformResolver.java:433)
at org.sonatype.guice.plexus.lifecycles.PlexusLifecycleManager.initializ
e(PlexusLifecycleManager.java:338)
at org.sonatype.guice.plexus.lifecycles.PlexusLifecycleManager.manageLif
ecycle(PlexusLifecycleManager.java:296)
at org.sonatype.guice.plexus.lifecycles.PlexusLifecycleManager.onProvisi
on(PlexusLifecycleManager.java:148)
at com.google.inject.internal.ProvisionListenerStackCallback$Provision.p
rovision(ProvisionListenerStackCallback.java:108)
at com.google.inject.internal.ProvisionListenerStackCallback.provision(P
rovisionListenerStackCallback.java:55)
at com.google.inject.internal.ProviderInternalFactory.circularGet(Provid
erInternalFactory.java:68)
at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(
InternalFactoryToInitializableAdapter.java:45)
at com.google.inject.internal.InjectorImpl$3$1.call(InjectorImpl.java:96
5)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.ja
va:1011)
at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:961)
... 21 more
Caused by: java.lang.IllegalStateException: Service is not registered class='int
erface org.eclipse.tycho.core.facade.ProxyServiceFacade'
at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.get
Service(DefaultEquinoxEmbedder.java:291)
at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.get
Service(DefaultEquinoxEmbedder.java:270)
at org.eclipse.tycho.osgi.configuration.OSGiProxyConfigurator.afterFrame
workStarted(OSGiProxyConfigurator.java:30)
at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.doS
tart(DefaultEquinoxEmbedder.java:180)
at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.sta
rt(DefaultEquinoxEmbedder.java:67)
at org.eclipse.sisu.equinox.embedder.internal.DefaultEquinoxEmbedder.che
ckStarted(DefaultEquinoxEmbedder.java:299)
... 34 more
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/InternalErrorE
xception
Press any key to continue . . .
Solution: ignore this error at that moment since all builds are successful
Import project into Eclipse
Reference:
http://czt.sourceforge.net/dev/eclipse/index.html
- Download Eclipse Classic 4.2.0
- Install m2e connectors
- install maven-jflex-plugin and xml-maven-plugin from
http://czt.sourceforge.net/dev/eclipse/updates/
- Install m2e release for Eclipse
- from
http://download.eclipse.org/technology/m2e/releases
- Select the m2e repository cache directory. m2e has caches lucene index in two places
- Per-workspace indexes are stored under
.metadata/.plugins/org.eclipse.m2e.core/nexus
- and there is also global cache in
~/.m2/repository/.cache/m2e/${m2e.version}
- The default cache directory on Windows in the department is the home directory
h:\.WindowsProfile\.m2\
. However, this folder has very strict limitation of disk volumn. Thus the cache directory has to be changed.
- Open Eclipse preference, click
Maven/Installation
. Add external Maven d:\randall\Programs\apache-maven-3.0.5
, and unselect the Embedded 3.0.4
- The settings.xml file will be in
d:\randall\Programs\apache-maven-3.0.5\conf
. Open settings.xml, and change <localRepository>
to <localRepository>d:\.m2\repository</localRepository>
- Save the changes in Eclipse
- Open a command prompt window and rebuild the czt-code again
- buildall.bat
- Now all cached files are saved in the specified directory, and can build successfully
- Thus the previous
Build Error
with long error log is due to the limited size of cache repository
- After the build, open Eclipse and import the czt projects into the Eclipse by
File > Import > Existing Maven Projects
- Select the czt-code root directory and import all necessary projects
- After import, workspace will build automatically
- Set CZT target platform
- Open target definition file at
/net.sourceforge.czt.eclipse.target/net.sourceforge.czt.eclipse.target.target
within Eclipse and clock Set as Target Platform
- If necessary, right click the project and
Maven > Update Projects
to update Maven projects
- If necessary, clean all projects and build again
For the eclipse and CZT in Ubuntu 12.04 LTS, things are different. When setting the external Maven installed under /usr/share/maven(3.0.4) in the preference->maven->installation in Eclipse, it always fails to import and build the workspace. Then if switch to the embedded Maven 3.0.4, import CZT and build workspace are successful.
ReplyDelete