Is it possible to have in the same solution a project in Java, another in Python and another in Scala? Or all the projects must be either in Java either in Scala?
You can mix Java and Scala in a single Maven project. Read the following tutorial for more information:
Scala with Maven
Python and Maven: well python doesn't need to be compiled like Java or Scala code does. Instead, python project building is about resolving dependencies, running unit tests, creating installables and so on. Unfortunately, python has its own way of doing these things that different from Maven. To the extent that it probably doesn't make much sense for Maven to manage python code.
Having said that, you can "lightly integrate" python into a Maven build system by having Maven run a setup.py script as an external command. Here is an article that describes this approach:
Python & Java: a unified build process (1/4)
Related
Here is my situation: I am turning in a coding challenge for an interview. We are allowed to use any programming language, I chose Java. I completed the project and it provides the correct output, but I am stuck on some technicalities of turning it in. The spec says that it will be compiled and run using the terminal on a mac or linux machine, and it says to "turn in source code only, please do not include compilation artifacts or binary dependencies". I have a couple jars as dependencies. Does this mean I can't include them with my source code? How would they compile the program then. Right now I am not using any management tool. I could use Maven and declare the dependencies in the pom.xml, but then I have to assume whoever grades my solution has Maven installed to run "mvn".
Should I stick with a basic java project and include the jars, use Maven instead, or is there another better way to do this? Sorry if I am overthinking this, I want to make it simple to run my project so my work can be assessed for its accuracy, not how I packaged it.
Yes, you can't include any dependencies as JARs. You need to use Maven or Gradle for this.
You don't need to assume that Maven is installed, Maven Wrapper can be used instead.
You can provide mvnw, what stands for maven wrapper. It's project-local installation of maven that is treated as source code and is used by calling ./mvnw instead of global mvn command (to make it working for the first time, use mvn -N io.takari:maven:wrapper). Reference.
I have googled aplenty, and I find scraps of info here and there, most old, and I haven't found a good answer.
I need to write scala and Java, and I'd like to do so inside the same maven project. I would like to use IntelliJ or Netbeans if that matters, with the latest Scala lib and Java 8.
What is the best way to create a maven project with Scala and Java code in it?
I've seen this but it's kind of old
Maven: mixing Java and Scala in one project
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'm looking for a plugin that would run in a console continuously to scan a Maven project's test sources directory, and when it detects a change kicks off a test cycle. Something analogous to mvn scala:cc or the Scala Build Tool, but for Java. Can anyone point me towards one?
I have personally used sbt even for a java only project just for continuous test feature.
I added a sbt build file to a maven based project and use sbt when developing, but use maven when building the final package, starting embedded jetty etc and this has worked out quite well.
I've just discovered that the scala-maven-plugin supports both continuous compilation & testing, as well as cross-compilation (Java + Scala). So it's possible to use it over a pure Java build and get all the continuous build goodness.
Recently, I have had a need for a solution to this. Having been learning scala and finding about the goodness of sbt ~test, I want to apply it to Java projects that do not have continuous test.
Using the scala-maven-plugin that you mentioned, I have created a github seed that will run Java Junit tests everytime I save a Java source or a Java test.
Check it out:
https://github.com/ailveen/maven-scala-java-continuous-test
The project is very simple right now (contains only Java files because that is my current need) but in the future I hope to add scala test (or specs2 or scalacheck) so it works with mixed java and scala files.
Hope you find it useful.
It is not exactly for Maven, but JUnit Max does continuous testing and if you're on Eclipse it might be the tool you would like to check out
I'm not having much luck searching google for this - are there any JRuby unit testing frameworks for Java code that integrate with Eclipse or Maven? Is there perhaps a Cucumber flavor that integrates with Eclipse, and if so, could someone point me to a quickstart guide explaining how to do it? :-(
Have you looked at cucumber-jvm (previously cuke4duke)? From the project README:
Cucumber-JVM is a pure Java implementation of Cucumber that supports the following programming languages:
Clojure
Groovy
Ioke
Java
JavaScript (Rhino interpreter)
Python (Jython interpreter)
Ruby (JRuby interpreter)
Scala
Cucumber-JVM provides the following mechanisms for running Cucumber Features:
Command Line
JUnit (via IDE, Maven, Ant or anything that knows how to run JUnit)
We've been using it in our CI builds with Maven and it works great. It looks like you can also write your tests in JRuby.