I am using Intellij for scala project. I am using babun application for compiling/running/creating assembly jar for my project because in my organization, we can't use maven artifact repository and we have our own for downloading dependencies so I had setup proxy for it in babun(could not see such option for windows command application). Through babun, I downloaded all dependencies as defined in build.sbt and it got downloaded in <USER_DIRECTORY>/.ivy2/cache
Somehow, when I Synchronize my project in Intellij, it doesn't show up any dependencies(under Project Structure->Project Settings->Modules->Dependencies tab) and I get error in my code for all classes that are coming from dependency jars. It was working fine before but IDK what I did wrong suddenly :(
I also tried setting up VM argument Dsbt.ivy.home= but no help.
Also followed article - Changing Ivy Cache Location for sbt projects in IntelliJ IDEA?
Related
I am new to IntelliJ IDEA. I am importing my Scala-SBT project for the first time.
After import, it showing lot of Class Not Found problems. But in IntelliJ SBT console, clean, update, compile everything working fine. Because it is not a startup project, it is running project, lot of other people are already working.
Now, clone seperately and imported as local Scala SBT project still it not recognising my dependenty jar. Still, Class Not Found in all classes.
But I don't know, how to make automatically consider my dependencies from by build.sbt.
Also should I need to import in project settings as third party jars?
Check if there is no errors during import. If they are disable "download source" checkbox in project import settings.
You can always reimport project in IntelliJ from SBT panel
I found solution finally,
I imported as Scala SBT project and i selected build.sbt file in the root folder instead of project root folder.
Downloaded exact Scala version of my project and put in project settings.
Refresh Project - It downloaded all needed jars and took 15mins to complete.
Anyway, All class not found errors thank God.
I want to run the puregwt-showcase project from geomajas in debug mode. I have checked the debug configuration and my maven dependencies are included. (should there by any particular order here?).In my maven dependencies i have this jar boss-marshalling-river-1.3.6.GA.jar included. So naturally if it is in my maven deps and my maven deps are on the debug confing claspath it should be detected right?...this is the stacktrace returned http://pastebin.com/xdkwLGkX . I have also asked on majas dev mailing list but nobody answered plus this seems more like a gwt and spring issue so i'm trying my luck here
Hoping to get so answers, or at least some leads,
Otis
EDIT: Another issue i have is that after i run gwt devmode another error pops up in my source: Template file CaptionImpl.ui.xml is missing (expected at org/geomajas/puregwt/example/client/widget/ShowcaseDialogBox) . This only appears if i run the gwt in devmode. If i try a maven install and run there are no problems.
You server-side classes and dependencies have to be in your war folder's WEB-INF to be picked up.
As you're using Maven, you first have to mvn package your app to move all dependencies to target, and then run DevMode with the proper war directory; see https://developers.google.com/eclipse/docs/faq#gwt_with_maven
I want to use scala compiler library, and add it in Eclipse,
but when compiling the project again using eclipse, the library is deleted automatically by the compilation. What's wrong with that?
So the question is: if my play project want to use scala-compiler.jar, how to add that?
it does not work by using build path-> configure build path... in eclipse...
I also tried to put all the jar files to the lib/ folder, but when compiling again in the server using eclipse, it still gives out compiling errors because of not finding the jars.
Thanks in advance,
The most failure-proof way to add it is to use Play's configuration builder, not adding it explicitly with Eclipse. To build a correct Eclipse project, use:
$ play
[YourProject] $ eclipse
[info] About to create Eclipse project files for your project(s).
[info] Successfully created Eclipse project files for project(s):
Then you can import it from Eclipse under File/Import/General/Existing project… (see here for more).
Note that Play uses sbt, which is already configured to use some version of Scala.
We have a multiple modules in our Java project and each module publishes SNAPSHOT jar files to Nexus repository. All the sub-modules are directly dependent on the SNAPSHOT jar files.
During development, we want to depend on the Eclipse project rather than SNAPSHOT jars. So we introduced a flag which switches between the dependencies as shown below.
if(System.properties.'setupProject'){
compile project(':Core')
compile project(':Module1')
compile project(':Module2')
}else{
compile 'com.test:core:0.1-SNAPSHOT'
compile 'com.test:module1:0.1-SNAPSHOT'
compile 'com.test:module2:0.1-SNAPSHOT'
}
Executing the following command generates the .classpath file as expected.
gradle eclipse -DsetupProject=true
Is there a better way to do this? Can we use Gradle configurations to achieve the same?
I could not find good examples for the same.
At the moment this is the way to go. You might tweak this even more and instead of using a System property to mark a project as available you can check if the project folder is available (project is checked out)
cheers,
René
I'm added a dependence to my build.sbt (casbah). I did a sbt update, I did check my ~/.ivy2/cache directory and all jars are there. Do I have to add this ~/.ivy/cache directory to my Build Path and add the casbah as external Jar to my project? If no, probably no because I did try it, what should I do to be able to use this jar in my scala project?
EDIT
I found this instructions that helped me, but still a hack
Establish a simple project (general/project) named "IvyCache"
located at your ".ivy2/cache" folder just for library reference
purposes.
Establish a Scala project located at your "project" folder.
Add the following libraries to the Scala project by means of "Add
JARs" to the "Java Build Path":
3.a) All jars from "/IvyCashe/org.scala-tools.sbt" filterred by
"*2.9.1-0.11.2" or any other Scala/SBT version numbers.
3.b) A single sbinary_*.jar from "/IvyCache/org.scala-tools.sbinary".
3.c) A single test-interface*.jar from "/IvyCache/org.scala-
tools.testing".
Now your build files should compile within Eclipse.
The easiest way to manage this is to use the eclipse plugin for sbt. Then you can just say sbt eclipse on the command line any time you change the dependencies in build.sbt, and the Eclipse files will be automatically updated for you.
Doing it this way means that you will never have to manually configure your Eclipse build path. After all, sbt already knows how to construct the build path, so there's no reason you would have to do it manually.