I've downloaded the source code of Spark, extract it and build it according to the official document as follows:
wget http://ftp.tc.edu.tw/pub/Apache/spark/spark-1.2.0/spark-1.2.0.tgz .
tar xzf spark-1.2.0.tgz
cd spark-1.2.0
mvn -Pyarn -Phadoop-2.2 -Dscala-2.11 -DskipTests clean package
Finally I transfer the assembly jar file to local:
scp root@host:/home/workspace/spark-1.2.0/assembly/target/scala-2.11/spark-assembly-1.2.0-hadoop2.2.0.jar ~
I intend to import this jar file into my project in Intellij Idea, but this jar cannot be recognized by the IDE, and an error has be thrown: 'IDEA cannot determine what kind of files the chosen items contain. Choose the appropriate categories from the list.', which is shown in the following graph:
The bad thing is that there are many grammar error in my edit windows which are all related to Spark package and Hadoop package, whereas the project can build successfully in this scenario regardless of the grammar error mentioned above.
P.S.
I'm 100% sure that some of my other jar files (e.g. in .m2 directory) can be imported normally without the aforementioned error/warning.
If I import the same jar file into Eclipse, it is recognized successfully. I've tested this jar both in IDEA-13 and IDEA-14, which all fails.
Viewing the content of this jar via jar -tf XXX.jar
works normally.
After adding this problematic .jar file into my project, I can't even view the content of the jar file.
This is what a normal .jar file looks like:
I've uploaded this jar in BaiDu_YunFile, Could anyone give me some idea? Thanks a lot!
You can also add jars using Spark submit option --jar , using this option you can add a single jar or multiple jars by comma-separated.
Check the jdk version (Perfrence-->About Intellij IDEA) which the Intellij IDEA used. If the version is too low, it cannot parse the jar properly. If you use the mac IDEA, just update the jvm version to 1.7 or newer in the info.plist of the IDEA contents folder.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With