Error creating junit in groovy project - eclipse

I just downloaded groovy plugin for eclipse4.2 from http://dist.springsource.org/release/GRECLIPSE/e4.2/ .I don't have any other installation/ library for groovy on my system. I am able to run groovy programs on my machine in eclipse.
However when I try to import org.junit.Test, I get following error.
Groovy:class org.junit.Test is not an annotation in #org.junit.Test
Groovy:unable to resolve class org.junit.Test
Can anyone tell me what might be the issue?

You must add the JUnit jars to your classpath. Select a Project -> Build Path -> Configure build path... -> Librarires -> Add library -> JUnit -> Next -> JUnit 4 -> OK.

Related

How to export Scala Spark project to jar

Im working on Scala/Spark project,i would like to export my project to jar file and run it into spark via spark-submit.
I tried this solution :
File -> Project Structure -> Artifacts -> + -> Jar -> From modules with dependencies -> Selected Main Class after browsing -> selected extract to the target jar -> Directory for META-INF automatically gets populated -> OK -> Apply -> OK -> Build -> Build Artifacts -> Build.
But i didn't find my main class on the jar file so i can't run it.
The basic Idea that you can follow:
As you are working on Scala
You can use sbt as your build management system to add all the dependencies to your project
You can use sbt assembly pluggin to build fat jar
Export this fat jar into your cluster to submit the spark jobs.
pls use Google to get more details...
or you can use this project https://github.com/khodeprasad/spark-scala-examples to start with and integrate sbt assembly plugin to create fat jars by following their documentation https://github.com/sbt/sbt-assembly

Error While Running spark on Eclipse

enter image description here
Getting this error while running spark with scala can anyone suggest how do i solve this issue.
You have not created this as a maven project. What you need to do is delete this project from eclipse. then :
File -> Import -> Maven -> Existing Maven Project -> Select your folder.
This would load your project and include maven dependencies and you would not face errors.

Error: Could not find or load main class while trying to run spark from eclipse(scala ide 4.3)

i have build the project using sbt and imported into eclipse . while trying to execute from run configuration i cannot find my main class and on running the application its prompted with the following error : could not find the main class.i have installed spark-hadoop version 1.4 and scala version 2.10.6 in the local machine also changed the scala compiler version to 2.10.6 in scala ide . The same error is produced while trying build spark from eclipse using maven . Please advice..
Check if Your main class in on build path.
Project -> Properties -> Java Build Path -> Source tab
If not add appropriate folder(s).
Add the folder where classes are generated to build path -> configure build path -> java build path -> source -> "Default Output Folder" text box.
Check if you have .scala files included in compilation path.
Even if you have the source folder included, it may be possible that .scala files are not being picked up.
The following might help, I was facing the same issue and it solved the problem for me:
build path -> configure build path -> java build path -> source -> add **/*.scala in the Included section.

Cannot import existing Maven projects - Broadleaf

I'm trying to setup Broadleaf in my local machine, I'm following the getting started guide and I'm having an error on the step when I import existing Maven projects in eclipse Juno, I get the following error
An internal error occurred during: "Importing Maven projects".
org.eclipse.wst.common.componentcore.internal.impl.ReferencedComponentXMIResourceImpl cannot be cast to org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource
I tried to Google it but the only info I could get was this but wasn't helpful
Update Maven project internal error - ReferencedComponentXMIResourceImpl cannot be cast to JptXmlResource
Please help.
I got a work around. I Downloaded Eclipse Luna, then I ran mvn compile on the root pom from terminal, then I went back to eclipse to import existing Maven projects. Worked like a charm.
There is a solution posted to solve this cast exception in Eclipse Juno,
post here: Update Maven project internal error - ReferencedComponentXMIResourceImpl cannot be cast to JptXmlResource
by disabling the JPA Configurator in eclipse preferences,
Preferences -> Maven -> Java EE Integration -> Select active Java EE configurators -> disable 'JPA Configurator'
It worked for me. Hope it works for you.
Inside Maven Parents Folder in Package Explorer, goto DemoSite - > Right Click -> Maven -> Update Project. Then Import the project. Will work fine.

Eclipse Dynamic Web Project Error - The imports org.apache.axis2.om Cannot Be Resolved

My Eclipse project underlines in red the imports below 'org.apache.axis2.om' with message...
'The imports org.apache.axis2.om Cannot Be Resolved'
import org.apache.axis2.om.OMAbstractFactory;
import org.apache.axis2.om.OMElement;
import org.apache.axis2.om.OMFactory;
import org.apache.axis2.om.OMNamespace;
What is the cause and how can I fix it in Eclipse..?
Regards,
You need to add axis2-kernal jar to your project. This can be done by right clicking your project then click build path -> configure build path -> libraries - add external jars, then you can add this jar from your system to your project.