Scala/Lift error on jetty:run - maven - eclipse

2019-05-29 04:13发布

问题:

I get this error when i run Maven with jetty:run, I wanna run a lift project on eclipse, it happened to me on macbook as well as on PC:

Building FirstLiftweb Project 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> maven-jetty-plugin:6.1.22:run (default-cli) @ FirstLiftweb >>>
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.864s
[INFO] Finished at: Sun Apr 01 17:56:45 CEST 2012
[INFO] Final Memory: 10M/79M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project FirstLiftweb: Could not resolve dependencies   for project 
net.liftweb:FirstLiftweb:war:0.0.1-SNAPSHOT: Failed to collect dependencies for [net.liftweb:lift-mapper:jar:2.0 (compile), javax.servlet:servlet-api:jar:2.5 (provided),
junit:junit:jar:4.7 (test), org.mortbay.jetty:jetty:jar:[6.1.6,7.0) (test), 
org.scala-lang:scala-compiler:jar:2.9.1 (test)]: No versions available 
for javax.mail:mail:jar:[1.4,1.4.3) within specified range -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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 read the following articles: 
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

Im new to this so would be nice if you could help me out, hopefully there is some lift community here, I just lift after doing python/django ruby on rails and php, now I wanna go the scala way cause I think this is a very powerful language running on JVM which makes it fast as a rocket haha,

thank you

UPDATE


The solution below worked out. Ive also seen after restarting my laptop that there was more options on creating lift projects by versions with maven. First I only had the choice to select net.liftweb then there was more net.liftweb 2.9.1 basic, blank etc and older versions. I also had to adjust eclipse a bit with the AJDT plugin so the debug for lift works correctly. You have to activate it and then right click on the project > configure > convert to ajdt, cheers

回答1:

I can't reproduce this exact error, but it looks like you're trying to use an old version of Lift (2.0) with Scala 2.9.1, which is likely to cause this kind of problem. If you post the relevant parts of your pom.xml the problem might be easier to diagnose.

Have you tried using one of Lift's Maven archetypes?


Update: If I change scala.version in your linked pom.xml to 2.9.1 I can reproduce your error above. To fix the error, all you need to do is change the lift-mapper dependency to the following:

<dependency>
  <groupId>net.liftweb</groupId>
  <artifactId>lift-mapper_${scala.version}</artifactId>
  <version>2.4</version>
</dependency>

This compiles for me.