I have an existing java project in Netbeans. I would like to start coding parts of it in Scala. I can add ".scala" files to the project but apparently they aren't compiled.
Can I somehow modify the existing Netbeans project settings in order to build java and scala sources together or do I need to create a new project and import the existing (java) sources?
Thanks
Martin
EDIT Sorry, I forgot to mention: I've installed the Scala-Plugin for netbeans, so compiling scala code is feasible.
I can create a new (Scala) project and add both scala and java sources to it and it compiles perfectly. My question was if (and how) it's possible to migrate an existing "java-only" project towards such a "mixed" project.
I don't think this is possible in the way you want it. You could however write an Ant build-script and let Netbeans execute it when building you application.
Otherwise I suggest to just create a new scala project and import it as *.jar library into your Java application. This keeps your project clean and nicely modularized.
You will need to migrate to use something like Maven to do this for you, as Netbeans doesn't know how to compile Scala code. Maven can be configured to compile the .scala files first then the .java, resulting in your final compiled source.
Have a look here for the maven config.
I would recommend doing a new maven project, Project form Archetype, and use the following.
http://mvnrepository.com/artifact/org.scala-tools.archetypes/scala-archetype-simple/1.3
This basically auto imports you a project all set up to get started running scala in a Java project.
Related
I'm doing a java project with some friends of mine, using intellij as IDE and gradle to build the project, recently I started learning clojure and I'd like to include Clojure code in our java project, as we know if it was Lein handling the project I coud easely interop both java and clojure with each other, but my friends have no interest in using Clojure or changing the project structure (understandably of course), is there anyway I can keep the development using gradle and intellij without having to compile Clojure into jar and include it has a external dependency? (use gradle so it can build the java and clojure in the same project or something like that)
I already tried finding plugins but I couldnt get it to build the project from intellij has it would keep getting errors... Thanks in advance for the responses.
I have a project in java on netbeans 7.3 that I need to add more classes to. However, I am working with scala on eclipse. How can I import those classes from my eclipse project and execute them when I run the program on netbeans?
Not sure since I've never really configured stuff - just coded in prepared environments :(
If you are developing a library in your Scala application, i would suggest to use sbt and package the library as a jar and import that jar to your java project.
You will have to define a build file in sbt. I am not sure whether you already defined it and use the sbt package command.
sbt package
Try using sbt
My web project includes Groovy class files.
How should I compile it for my project using Eclipse?
Rest of my team is using IntelliIDEA to use it but I want to set it up in Eclipse.
To start with I have installed a Groovy Plug-In for my Eclipse and installed Groovy on my Windows.
You should be able to right click on the project -> Configure -> Convert to Groovy project.
If your project is a maven project, then you should also install m2eclipse as well as the optional m2eclipse configurator for groovy-eclipse. This will automatically configure your project for Eclipse and groovy.
Hope this links helps you. It has step by step on how to import your existing Groovy Project into eclipse so you can work on it.
http://docs.codehaus.org/display/GROOVY/Create+Your+First+Groovy+Project
If the project is created using grails create project, I believe all of the .project and .setting files are there for eclipse.
If you have the groovy eclipse plugin installed you should be able to mix your groovy classes into the same packages as your java code. Are you using maven or ant to build your actual war file? If not you will have to make sure that you compile the groovy classes along with the java code. while in eclipse you will be fine. Both ant and maven have facilities for compiling the groovy and java code together for your actual war that you deploy.
I have an existing EJB project set up in Eclipse Helios, and would like to slowly introduce Scala into the project. The Scala IDE has been installed successfully, and I'm able to create standalone scala project. The issue however comes when trying to use my existing project with scala additions. I've went as far as manually editing the .project, .classpath, and related files under .settings of the project's home directory for eclipse.
However I still have the issue where the Java compiler tries to compiles .scala classes, which results in errors and ultimately not being able to build the project.
Has anyone faced a similar scenario or are there any workarounds?
Thanks in advance.
You should be able to right-click the project, go to "Scala" and click on "add scala nature". Then .scala files should be recognized as such. You might also have to add the scala library to your dependencies. Depending on whether this is a "simple" Eclipse project or you're using Maven there might be other steps required.
Right click on project, and choose Configure/Add Scala Nature.
I have an eclipse plugin project which dependes on java project in my eclipse. usually what I did is export the project as jar and use it as-is in the plugin. but this requires manual work. can I have a reference from my plugin projct to a java project that will be both compile-time and run-time dependency ?
I saw a similar question, but not exactly the same.
I think, the closest thing to this is to create a jar file from the referenced project, and import it to the projects repository. But thats quite hard to manage for a currently developed project.
On the other hand, isn't it possible to simply convert the Java project into a plug-in permanently? If the other user does not use OSGi/Eclipse, he/she will see only a manifest/manifest.mf file (and possibly a plugin.xml) next to the java project specific stuff, so this would not disturb them, but would help you.