So I am doing major change in a library(maven) which I have developed, and using it in one of the playframework project.
I have finished refactoring changes in maven artifact, published it to repository with new version.
Now I want to see where all this will give errors in play project, so that I can go and fix 100s of such errors. Ideally I would like to use eclipse or some IDE to report me all the errors, so that I can easily navigate and fix.
But problem is that eclipse doesn't know about new library version. To tell that to eclipse I have to upgrade library version in build.sbt, compile and re-create eclipse project. But since it contains many errors, I can not create eclipse project before fixing those.
Is there a way to visualize all those errors in eclipse or any IDE in such cases?
You did not mentioned, if the play project is a maven project as well. I am working with play as a maven project, which is created like this. But I suppose, that with non-maven project the following works as well.
From the command line run:
activator eclipse
In eclipse do 'refresh' to the project. Now you can see all the errors caused by the changes in your jars.
Related
Say I open an Eclipse project in IntelliJ IDEA, and then I add a library dependency in Eclipse.
How can I sync the .iml file with the modified .classpath one? If there is a way...
If you want to keep dependency consistency across IDE's and achieve even more if you want it... You must use Maven.
Maven is awesome about it. You only will have your project's real code and a file called pom.xml.
You are able to add dependencies in the Maven way to that pom.xml and no matter what you are able to run your project in IntelliJ, Netbeans, and Eclipse without a problem, even across multiple developer on different IDEs.
You can learn a good deal about Maven from this tutorial:
https://www.tutorialspoint.com/maven/
It shows you it's usage in Eclipse, IntelliJ and Netbeans in the last chapters of the tutorial.
I am new to spring framework and having basic knowledge of maven. I tried to import spring project in eclipse. (File - Import - Existing Maven Projects). I see that,
1) The project is not imported as java project. i.e. if I right click on project and see the properties, I dont see options such as Java build path, Java Compiler etc.
2) I am looking for one particular class in the project, but it is not there, although I can see that class from terminal. Therefore it very much exists in the project. So why cant I see it in Eclipse ? Why is it not imported with the project ?
Please note that I use Eclipse_Juno and I can compile the project with maven on terminal and in eclipse.
There are a couple of things that could have gone wrong. Hard to say what happened.
If the project you have imported builds on the command line (mvn clean install) then chances are good it is importable into an IDE with not much trouble once the settings are ok.
Make sure you have the m2e (maven 2 eclipse) plugin available. So eclipse can detect its a maven project. If you also use spring I would give the Spring Tool Suite (STS) a try: http://spring.io/tools
If the project is not recognized as java - or the essential facets are not detected - I would try to figure out why. Maybe something in the preferences is not properly set up? (maven home, executables, sdk, ...)
Edit 2: I seem to have discovered the problem: the JAR files that were downloaded to my m2 repository are corrupt:
It seems to me that they could be causing the problems. But why are they corrupt? And how can I fix that?
Edit: I've ran mvn eclipse:clean eclipse:eclipse in the project, and it completed successfully... and introduced 5 additional errors:
On another PC I've created a Scala Maven project using the m2eclipse and Scala IDE plugins for Eclipse. I don't remember any errors. Then I pushed it to GitHub.
I then proceeded to clone the project on my laptop, but I was first greeted with this (error) message:
After selecting yes, what seemed to be the logical step, these errors appeared:
What's going on and how can I fix it?
(Linux, Elementary OS)
It is possibly a difference in Scala versions used. Scala IDE is usually based on specific version of Scala. Looks like your project pom.xml requires different version of Scala.
A solution is to either update your pom.xml to version of your IDE or upgrade the Scala IDE if possible.
The other possibility is that downloaded jars are corrupted.
Trying to get a lift project to run on windows, I've installed maven on my computer, then tried to use
mvn archetype:generate from cmd, then chose the lift basic one , but it always failed on the jetty:run part. Before that, I had to change a lot of the pom.xml file to even get a successful build (since the tutorial I was using was obsolete and it couldn't find the dependencies).
So I've decided to try with the eclipse plugin, thinking it should be easier.
I've installed the maven plugin for eclipse and created a project with the lift archetype.
The project was succesfully created, but I have all kinds of errors in the editor for missing ; and so on (I have scala ide installed on eclipse also and creating a normal scala project works and compiles/runs fine). I have also tried to include the scala-library.jar in the buildpath, with no change.
The odd part is that I can run the cmd and go to the project folder, then run mvn jetty:run and it will actually work (?!) Trying to run in eclipse with jetty:run as goal will give me ClassNotFoundException on the HelloWorld snippet.
So what might be wrong with my settings?
UPDATE: no luck whatsoever, after trying 3 different eclipse versions, installing the maven for scala plugin and following every tutorial I could find. It just simply feels all is outdated on the instructions:
this is how it looks after I include the scala libraries for eclipse on every project (after I create it from an archetype):
is this "mvn archetype:generate" up to date? I don't know if anybody guarantees it will work at all..
Anyway, the default way to at least try Lift and see it working is the following: https://github.com/lift/lift_25_sbt
It uses "Simple Build Tool" instead of maven, but maven should work, too. Also, you can easily read "build.sbt" to get all the dependencies.
Plugins for creating eclipse/intellij project definitions are included. (See the README of the demo project.)
The target to create eclipse project is "eclipse" or "eclipse with-sources=true".
The target to launch the app is "container:start".
I am experimenting with a small Scalatra web application, which I have imported as a project into Eclipse.
I have used Eclipse to manage a few Lift applications before. With a Lift project, SBT copies all the dependency JAR's to a /lib_managed directory. I can therefore add those JAR's to Eclipse's build path, and it co-exists with SBT just fine without complaining about missing classes.
With Scalatra, however, the dependency JAR's don't seem to get copied anywhere helpful during the development cycle. If you build a WAR file, then the dependencies get bundled up into that... but there doesn't seem to be anything like Lift's /lib-managed directory.
Assuming that anyone else uses Eclipse in developing Scalatra projects, how might I easily set up Eclipse's build path? I suppose that I could manually create entries that point my local Ivy repository one-by-one, although that seems a bit ugly. Perhaps there's an easy way through SBT to setup something similar to Lift's /lib-managed subdirectory inside the project directory.
It looks like the best approach for this is using the SBT plugin for Eclipse.
This is not an "Eclipse plugin" for managing SBT. Rather, it's an "SBT plugin", for generating the .project and .classpath files used by Eclipse. The Maven world used to deal with Eclipse in a similar manner, before the m2eclipse Eclipse plugin reached maturity over the past couple years.
With this plugin installed (I installed it globally so I wouldn't have to change my project's files), you just type sbt eclipse after any changes to your dependencies. SBT will then update your Eclipse project files to match.
You could also use my Maven prototype, then simply import the maven project into Eclipse. Quite nice and you're not forced to use SBT.
https://github.com/fancellu/scalatra-maven-prototype