Eclipse running lift project (project configuration issues) - eclipse

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".

Related

Converting playframework project to eclipse project when it contains errors

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.

Use Gradle plugin without adding to build.gradle?

In Maven you can do mvn eclipse:eclipse to run the eclipse goal of the maven-eclipse-plugin. Is there a similar way to do this in Gradle? I'd like to run the plugin for my IDE of choice but I want my build script to remain "IDE-agnostic".
I don't want apply plugin 'eclipse' in my build.gradle file but want it to generate the Eclipse files it needs. This way users of IntelliJ won't need to swap it.
Rather than rely on the build tool to configure your IDE (who ever thought that was a good idea is beyond me), set up the IDE to understand and integrate with the build tool. Eclipse is specifically designed to share configuration in such a way that each person who checks out a project from source control gets the project configured correctly with a minimum of manual intervention. Gradle support is much newer and somewhat less mature than Ant or Maven, but it works. See the Buildship project, which allows you to point Eclipse at your existing Gradle-based project and import it as a properly configured Eclipse project, no need for hacks like mvn eclipse:eclipse (which is now deprecated/retired, by the way)

class missing after Importing spring framework project in eclipse

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, ...)

Working with a Scalatra application in an Eclipse workspace? (i.e. build path)

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

JavaRebel with a Multi-module Enterprise Project in Maven

Does anybody have experience working with JavaRebel, specifically for a large web application built using Maven? There is a JavaRebel plugin for Maven that seems under-documented, does anybody have comments on how it works, can you really update one class in a Multi-module Enterprise Project and have it "automagically" change on your Server?
Are there any issues with different IDEs and this setup? For example NetBeans will not let you compile one class at a time in a Maven project (from what I can tell).
Disclaimer: I work for ZeroTurnaround.
JRebel (formerly JavaRebel) installation involves the application configuration file "rebel.xml" and modifying the container startup command line.
The Maven plugin is used to generate the "rebel.xml" file, that is used by the JRebel agent running in the container to find the files in the workspace. This allows to use IDE building to compile .java files and skip the Maven build process, as the changes to files will be picked up from the workspace. However as it relies on the IDE to compile the classes, it does depend on the IDE ability to compile efficiently. I know for sure that Eclipse will compile classes one at a time and am fairly sure you can configure NetBeans and IntelliJ IDEA to do the same.
In addition to the Maven/rebel.xml configuration you also need to configure the container startup command line. You may also need to install and IDE plugin or do some additional configuration to have the best expirience with JRebel. Following through the steps of Installation manual ensures that.
Hope this helps.
Disclaimer: I've not actually used this plugin myself.
This tutorial implies that JavaRebel works well with Eclipse 3.4. If you are also using m2eclipse it should work ok with Maven projects as well (as long as you ensure that Maven and Eclipse are compiling to the same target folder so the Eclipse incremental compiler can be used to modify the class file).
According to this post, you should configure the javarebel-maven-plugin to generate the rebel.xml (used to mount external folders to the application classpath). There's also a general installation guide you may find useful.