I'm trying to understand what's the best way to setup a project
that is a mix of java and scala and that will use lift.
Lift is intended to run embedded by jetty in another application.
I'm comfortable to work in Eclipse and also used to how it
works with ant as build tool.
I'm a relatively newbie in both scala and lift and get confused
about the different build tool and how to set up things.
I don't really understand maven and haven't really looked at sbt,
but it seem to be the choice of scala developers, but I'm also
dependent on quite some javacode.
Any suggestions, links, tutorials or else on how to setup
the best environment so I can work comfortably in Eclipse
and also build releases quite easily given my scala/java/lift/jetty
enrironment?
I would say that if you are comfortable using Ant as a build tool, Maven should be a piece of cake to use instead. It's main advantage is encouraging conforming to conventions rather than lots of configuration meaning that as long as you follow the standards, setup and usage of any most maven projects is a breeze. I strongly recommend that you invest the time to become familiar with this build tool because it will be very valuable experience/knowledge you can continue to use in your Java career.
With Maven aside, if you are convinced that you and the rest of the project's devs will all be using Eclipse, I would recommend using Eclipse's built in project management infrastructure. It uses Ant under the hood so you will be able to leverage you experience to also run/release from the command-line. All you need to do is set up a eclipse Lift project normally and then to add the scala integration, check out Scala IDE for pretty good IDE support of scala development inside of eclipse.
Good luck!
This screencast is what I used to get started. It starts with a git repository for an SBT template and then adds the Eclipsify sbt plugin to make it into an Eclipse project.
Related
I am new in Java and I am wondering what builds a java project if it is not Maven or Gradle.
In an IDE, you can also compile your java project and you do not need to use a Maven. Does it mean that such IDE (IntelliJ for example) has an own build tool behind the scene that is used for downloading all dependencies, running test and all that stuff?
Almost any project that grows past a few files requires a build tool of some sort. In the Java world Maven and Gradle are common with Ant and Ivy being somewhat less used anymore. Other programming environments have similar concepts and tools.
The IDE may not require this and has it's own build environment. But once you leave the IDE you still need a way to build - for example, in a build pipeline in a CI/CD environment. So it's better to start with some sort of build tool up front. Additionally, if you ever wanted to change your IDE you no longer have the same way to build. By using a build tool you are consistent across environments.
While I highly recommend a build tool, most build tools (at least the ones I'm familiar with) don't actually compile, that gets handed off to javac in the installed jdk.
Setting up a more sophisticated project, e.g. building a webapp, can be done without any build tool, but you'll need to (either manually or with a script) do the assembly (e.g. moving files into the right locations, preparing the deployment artifact, etc...). Doing that "custom" is a righteous PITA, hence build tools.
In the olden days, every IDE had its own proprietary build system.
This meant that if you wanted to migrate your project from one IDE to another, you had to recreate the project from scratch, move files over manually, and reconfigure actions to be done during compilation, testing, and building. Some migration tools were built to automate this tedious work, but they were often imperfect or incomplete.
With the growing success of tools like Ant, Maven, and Gradle, the IDEs began adding support for users to choose those tools in place of the IDE’s own proprietary features. The IDEs eventually embraced these tools so well that now a Maven-driven project or Gradle-driven project can be easily moved from one IDE to another with virtually no effort and no modifications. You can even build your project without any IDE, just using the command-line interface to the Maven/Gradle tools.
Today’s freedom to easily move between IDEs eliminates the fear of vendor lock-in.
IDEs today still carry their own build technologies. But I believe they are rarely or never used nowadays by the bulk of Java developers. The open tooling provides all needed functionality.
So I installed Apache Netbeans. Installed some of the plugins and instead of just seeing the Java folder in the categories when I want to create a new Project, I see this:
What is Gradle, Ant, and Maven? I am not familiar with Java and wanted to study the language, but I have no idea of what these are.
I keep seeing that I need to have certain plug ins installed and active.
Here they are.
Ant, Maven and Gradle are Java build tools. You don't really need to know the exact differences though.
Java with Ant
The "Java with Ant" option uses NetBeans' own internal project format (based on Ant). In older NetBeans versions this category was simply called "Java"
If you don't need to share your project with non-NetBeans users, use that option.
You will have to manage dependent libraries yourself (download, add them to the project) unless you are only using libraries and frameworks that are bundled with NetBeans. The turnaround times (the time it takes between you hit "Run" and the application actually starts) are the shortest with this option, as Maven and Gradle add substantial overhead to that.
Java with Maven
Maven is a standardized dependency and build management tool. A project defined with Maven can be used by everybody else as it automatically manages (and downloads) any dependency.
Use that option if you know you need to share your project with other people (e.g. hand it in your school or university).
Java with Gradle
Gradle is yet another build tool, which also manages dependencies for your and has more flexibility than Maven. However the build scripts are less standardized than in Maven. But that is also a good option if you know that you need to share your project with other people.
Unless you are using NetBeans 11.1 (which is currently in Beta) I would not use this option as Gradle support in older versions is not as good as Ant or Maven support.
You might want to go through the tutorials on the NetBeans homepage:
http://netbeans.apache.org/help/index.html
I've been using Maven for a while for my Java (and now Scala) projects. Recently, I've seen some talk about issue with Maven (example). Personally, I'm happy with it till now. I've used sbt for Scala a little bit and I think it works well.
Again my point here is not to say which system is better but to expore out what other alternatives exist and how real developers are using them for Java and Scala projects.
There is a Scala plugin for Gradle.
Alternatively you could use Scala's built-in Ant tasks and Ivy for dependency management (which is what SBT uses internally).
Yet another option is Apache Buildr.
Pretty much any build system designed for Java-based projects should work with Scala.
Related:
A Basic Ant+Ivy+Scala Setup
Comparing SBT and Gradle
Buildr vs. Gradle
I think if you're going to use Scala, you'll need to become familiar with SBT. It's the standard build system for Scala projects, and the build system of choice at every professional organization that I have worked at using Scala.
SBT has a bit of a learning curve, but it also has some amazing features - console is probably the one I use most - load up a shell with your project already on the CLASSPATH.
You can do some pretty clever stuff with SBT - in the end it's all Scala under the hood. The effort to pick it up is well worth it if you plan to work with Scala professionally.
I am trying my hands on the maven java Akka tutorials on the calculation of pi.
Please I am new to both: maven and Akka but want know if it is possible
to create a maven akka project and then import the project into
Eclipse IDE and be able to run the project in the eclipse IDE.
If it is possible I will be happy for some directions or tutorials
your suggestions are welcomed.
Here You have some information how start Akka, but first You have to know something about maven.
Since the exact link in tostao's post does not work anymore here is the link for the latest version of akka:
Akka Getting Started. Consider replacing current in the url with the actual version, 2.9.10 as of writing.
If you use eclipse you might want to have a look into scala-ide.
Typesafe, the company behind Akka and an important part of the scala world, also offer their own build tool i.e. sbt. Especially their typesafe activator templates are build on top of sbt which might suggest a preference of sbt over maven from their part.
I am building a plugin for Eclipse - but as we use Maven as a standard build platform I would like to be able to build the plugin using Maven.
I have found a previous question about using Maven with Eclipse Plugins - but as it is a year old I thought it was worthwhile collecting some new answers:
Is it currently possible to build Eclipse Plugins by Maven AND have nice IDE Integration?
It seems that Tycho has not been driven forward much in the last year - but has anything else been created that fulfils this need or is there an easier way?
Does anyone recommend still the Maven PDE plugin? Is this a cumbersome solution as it is just a wrapper for ANT scripts?
I'm on the Tycho mailing list and I see plenty of feedback that suggests that people are successfully building plug-ins using Maven. My current project isn't doing OSGi development, so I can't vouch from personal experience with the latest version of Tycho. It's also worth pointing out that Tycho currently supports (to the best of my knowledge) a manifest-first approach to building plug-ins (as apposed to POM-first) - this might be a factor in deciding if Maven/Tycho fits your project.
It seems that Tycho has not been driven forward much in the last year - but has anything else been created that fulfils this need or is there an easier way?
The project is definitely active (have a look at the git repository), regardless of the updates of its website and AFAIK Sonatype is using it (successfully) for m2eclipse.