what I wanted to do is to make the sbt portable, at least portable among different Windows machines, so that my sbt plugins, settings, ivy repo, etc. don't have to be setup again on every computer.
my approach is to put the sbt.bat, sbt-launcher.jar and all its required directories, like .sbt, plugins and .ivy into a folder to be synced by Dropbox or likes
I have successfully changed the boot/ivy directory by using -Dsbt.boot.directory -Dsbt.ivy.hom in command line for sbt-launch.jar, but I can't find the same for plugins or the whole .sbt folder.
finally I tried Sandro's solution, so far it seems working~~
You can use http://code.google.com/p/symlinker/ to create a Symbolic link to the .sbt folder in your Dropbox directory. That way, Dropbox will see the .sbt folder inside its own directory, while the "actual" folder will still be in the default location.
Related
I have a NetBeans project that uses the GSON library. I've tried including the GSON.jar file without requiring future users to separately download it. However it doesn't seem to work. The project looks for the file from the relative path of my computer so the file isn't found on another user's computer. Is there a way to include GSON.jar and "Export to Zip" and keep the reference in the project itself? I'm lost!
Thank you
Exporting a Project to ZIP zips up the project folder only, and not anything outside of the folder, including dependencies. If you include the GSON.jar file in the project folder, then the JAR file will be included in the .ZIP file. It's a good practice anyway since NetBeans will use a relative classpath and thus if you move the project itself NetBeans won't give you an error message when loading the project.
I have a Scala project I share via git between two (windows) machines. I have them set up using SBT and sbt-eclipse so I can edit and test within eclipse or build and test from the command-line.
Unfortunately my user name (and, therefore, the user profile directory) is different on the different machines. This means that when sbt fetches dependencies it puts them in different base directories on the two platforms. This wouldn't be a problem except that the full pathname is hardcoded into the eclipse .classpath file from sbt-eclipse. This means that I have to rerun the 'eclipse' task when I do a pull on my 'current' machine.
This must be even worse for others who do this kind of thing as a team. How is this normally handled? I would prefer to do a pull on whatever machine, even from within eclipse, and get started right away.
I would strongly recommend removing the eclipse-sbt-generated files (and all other generated files) from git. Each machine will have it's own .classpath file that is generated on that machine that is generated on that machine for that machine and can be regenerated whenever you want/need. Your build.sbt project files should be in git, so when you pull onto each machine, it will have the updated config, and you can just run sbt eclipse only when you have a dependency change.
Really, you should always avoid having generated files in source control. Have only the important stuff in your git project, and generate the rest as necessary.
I'm writing an SBT plugin. In this plugin, I need to add files to the resources directory within the resulting jar.
I don't want to change anything from the source directory (otherwise the user/developer may not understand why files appear to directory he's responsible for), but only in the generated jar.
How can I do that, is there a folder in target that correspond to the resource directory?
It seems like this is done by the "package" command, so if I can override the package command I might be able to do what I want.
Seems like I need to add stuff to resourceManaged.
I'm using eclipse 3.7 and my local maven repository has a bunch of jars in it. I tried to build the project on another computer that is on a different network and has *.jar download restrictions. I will not be able to get the restrictions lifted. Here is an example error:
e.g. Access denied to http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/2.3.2/maven-compiler-plugin-2.3.2.jar Error code 403, Forbidden (Content blocked ...)
It would be very nice if I could simply copy my .m2\repository\ folder into the .m2\repository\ on the other computer--both are running windows. I really don't want to manually install 100s of jars on the other computer.
Is xcopy for .m2\repository\ supported?
Yes, you can copy the .m2/repository folder to any other location/storage device you want.
Maven only needs to know the path to the local repository (by default it's in %USER_HOME%/.m2/repository). You can change that path in Maven's settings.xml (see settings reference) if you decide to keep the artifacts in a different location.
in my Java Eclipse project that contains JUnit tests, I also have a package "resource" that contains all input data used for the tests. But when compiling JUnit tests, the Java compile also data available in resources, so I find the same data in the "bin" folder. Is there a way to avoid this?
thanks.
If you have a particular package within the source path you want to exclude (your resources folder for example), you can right click on the package and select: Build Path > Exclude.
This will tell Eclipse that you don't want to include that package as part of the build.
This is making a couple of assumptions: that you're using Eclipse Helios (because the option might be different in older versions), and that the resources are stored in the same folder as your regular java source files (because if resources is in a folder by itself, you can remove that entire folder from the build by using Build Path > Configure Build Path -> Source tab.
Update:
After the discussion in the comments regarding why you would or would not want to copy resources into the bin directory:
The contents of your bin directory should be ignored and not checked into to a version control system (when using CVS, bin should be an entry in the .cvsignore file)
The resources are only duplicated on your local machine, which is fast and hard discs are big. I'm not sure you should be worrying about this
If you're using Class.getResource to access those resources, they need to be on the classpath somewhere. The bin directory is as good a place as any
So, realistically (barring some unknown, like the files are hundreds of gigabytes or something), I don't think you need to be concerned about excluding these files from the build.