Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

To compile XML syntax, the scala.xml package must be on the classpath. #79

Closed
Chikooo opened this issue Aug 19, 2015 · 19 comments
Closed

Comments

@Chikooo
Copy link

Chikooo commented Aug 19, 2015

Please help me on this.

@biswanaths
Copy link
Member

Which scala version are you using ? Did you updated your scala version recently ?

@jrudolph
Copy link
Member

See also: http://stackoverflow.com/questions/32087774/to-compile-xml-syntax-the-scala-xml-package-must-be-on-the-classpath

@Chikooo starting with Scala 2.11.x you can only use XML literals if you add an explicit dependency to scala-xml to your build. How to do this depends on the build system you use. The most recent artifact is currently this one: http://search.maven.org/#artifactdetails|org.scala-lang.modules|scala-xml_2.11|1.0.5|bundle

If you use sbt you need to add this line to your build definition:

libraryDependencies += "org.scala-lang.modules" % "scala-xml_2.11" % "1.0.5"

@biswanaths I think the problem is that there's a Scala compiler error message that points to https://github.com/scala/scala-xml without giving enough information about what is wrong if you are a Scala/Java beginner. Maybe the README could contain a section that helps these users to solve the immediate problem.

@Chikooo
Copy link
Author

Chikooo commented Aug 19, 2015

jrudolph:

Exactly without even giving what is wrong it is redirecting to GitHub. I am a scala beginner. I have added that line too in build.sbt
I am trying out spray project using sbt on IntelliJ

biswanaths:

I am using latest version of scala.

@biswanaths
Copy link
Member

@jrudolph , Lets augment the non-existent wiki with most commonly faced problems. I think that will be helpful and quick turnaround for common problems faced by the user.

@Chikooo
Copy link
Author

Chikooo commented Aug 19, 2015

@biswanaths
Do you have any idea how to do it in IntelliJ?
I am facing this issue since yesterday and couldn't find solution for it.

@jrudolph
Copy link
Member

@Chikooo you need to provide much more details. What did you try exactly? How did you come so far? How did you create your original IntelliJ project? What does it mean that you are "facing this issue since yesterday"? Time is probably not the reason that it now fails if it worked before so something else must have changed as well.

@Chikooo
Copy link
Author

Chikooo commented Aug 19, 2015

@jrudolph
Sorry for abrupt explanation.
I have started reading about Spray from 2 days and wanted to run basic web service to explore how it runs.
I have created a Scala SBT project in IntelliJ.
I have edited "build.sbt" file for the error I have mentioned above but still facing the same issue.
Can you tell me like for "scala-xml" what all files I need to change? and what changes I need to do?
OR
If you are familiar with IntellJ, can you tell me exacts steps to create Spray service from "scratch"?
Later will be helpful.

@biswanaths
Copy link
Member

@Chikooo , can you post your sbt file ?

@biswanaths
Copy link
Member

Will be closing this issue as without more information, I strongly believe this is a either a sbt configuration issue or intellij issue.

@Chikooo , Please do reopen the issue, if the issue is still persisting with more information.

@Chikooo
Copy link
Author

Chikooo commented Aug 24, 2015

@biswanaths : i could successfully run the code. I have added some line of code to the sbt file. thanks for your help. If you have basic sample spray codes can you send them to me?
If in case I face some issue in future i'll post here.

@biswanaths
Copy link
Member

Great that you resolved your issue. I work with spary, but will try to find any basic spray template and send it to you.

You are more than welcome to reach out, if you face any problems.

Have a good day.

@Chikooo
Copy link
Author

Chikooo commented Aug 26, 2015

@biswanaths
I am trying to build Spray service to fetch data from MySQL using scala.
Can you tell me which all files I need to create?
As far as I know, we need to edit

  1. application.conf
  2. case class file
  3. build.sbt
  4. plugins.sbt

Is there anything else I need to create? Do you have sample example for this?

@jrudolph
Copy link
Member

@Chikooo you can try asking questions like this on either stackoverflow.com or on the spray-user mailing list at https://groups.google.com/forum/#!forum/akka-user.

This is not the place where you will get answer for a questions about a totally different topic :)

@Chikooo
Copy link
Author

Chikooo commented Aug 26, 2015

@jrudolph oops. I am really sorry. :) I'll ask there.

@derek-pappas
Copy link

Scala newbie here with a solution including steps for updating the libs and refreshing in Eclipse.
If you want to use scala.xml and get compile errors in Eclipse try this:
Add this line to the build.sbt file as the @jrudolph mentioned above.

libraryDependencies += "org.scala-lang.modules" % "scala-xml_2.11" % "1.0.5"

$ sbt

> update
> eclipse

Go to Eclipse and refresh the project
The compile errors in Eclipse should be gone.

@biswanaths
Copy link
Member

Hey @derek-pappas , thanks for the steps. This will help lot of people down the line. I will try to put this in wiki. Thanks again.

@derek-pappas
Copy link

Hi

You are welcome. Thank you taking care of the code!

I was stuck until I guessed I had to use set update. I was glad I stuck
with it. I am tired of Java and Python. I can see that Scala can cut my
programming time significantly and make the code more maintainable. But the
entry curve into the language is steep because of the tools. I had problems
getting Eclipse and Intellij working until I figured out that I needed to
upgrade to Java 8. Neither Intellij or Eclipse told me to update the system
to Java 8.

What would be really cool is if in Eclipse and Intellij the error message
would actually tell the user what to do to fix the problem. There is a big
disconnect between what the error message says to do and what actually
needs to be done. I know that this improvement would help newbies like
myself immensely. I have used 6-7 different build tools and ~8 different
languages but the set problem had me stumped. I am not complaining but
informing you of the situation facing newcomers to the Scala/SBT world.

Some message like:
The blah blah lib has not been downloaded to your machine.
The blah blah lib should either be available by running an SBT update which
will then download the lib to the local cache or by setting your Nexus vars
to point to your Nexus server. Blah Blah Blah.

Splitting out the library makes sense but there needs to be a clear set of
instructions not just for scala.xml but for all libs that have to be added
to get the code to compile.

Looking in the ~/.ivy cache after I discovered it gave me a clue about what
the problem was.

Derek Pappas

On Fri, Sep 11, 2015 at 10:28 PM, biswanaths notifications@github.com
wrote:

Hey @derek-pappas https://github.com/derek-pappas , thanks for the
steps. This will help lot of people down the line. I will try to put this
in wiki. Thanks again.


Reply to this email directly or view it on GitHub
#79 (comment).

@ratibbrahim
Copy link

Hi Guys
I've a big issue in the same context , I was struggling running this code https://github.com/alejopelaez/VirtualP2P but i couldn't , Please , could anyone give a hand how to resolve this , I'm using eclipse, java 1.8 and scala 2.12
thank you

@SethTisue
Copy link
Member

SethTisue commented Aug 15, 2019

@ratibbrahim try https://users.scala-lang.org perhaps, and show exactly what you tried and what error you got

@scala scala locked as resolved and limited conversation to collaborators Aug 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants