I want to make it so, that when I export my project, Eclipse would create .jar file as well as folders and other files I desire on the same path. I am making a game and I rely a lot on external files, be it animation images or scripts, and it is very annoying copy pasting same stuff over and over again, additionally to making the "run" option not viable.
You can use Eclipse File sync Plugin to solve your problem, basically
this plugin synchronizes your eclipse workspace files to any external
folder you configured:
FileSync plugin for Eclipse is a file synchronisation tool. The main
goal is to keep files outside of Eclipse projects in-sync with Eclipse
project files. The plugin works as builder in Eclipse and will
synchronize all changes on Eclipse project files with mapped external
folders. E.g. if a file is created, changed or deleted in Eclipse,
then the mapped (external) file will be created, changed or deleted
too.
http://marketplace.eclipse.org/content/filesync
Related
I made a little java app that modifies an Android Studio project and executes "gradlew.bat" to build the .apk and move it to an "output" folder.
As you might expect this project has to be saved outside of the .jar (AFAIK I can't execute a Gradle build inside of it).
I converted it from a plain Idea project into a Maven project to automate my workflow a bit. But Maven packs my resources in the "res" folder inside the jar. It also builds in the "target" directory and I want it in an isolated folder.
I need Maven to build the .jar file with the source files in an isolated folder and, in the same folder, copy the resources to the file system instead of the .jar.
Edit: For clarification. I want the project to have a more standarized layout so I can push the project to Heroku. Heroku will compile and execute the .jar using its Maven configuration but will not pass the other files to the filesystem to be along the .jar and instead, pack the resources inside the .jar.
The result I want is:
Whenever I execute a Maven build, the "target" directory should have the .jar file and two resources (A folder with files and a .ini file) within the same directory. It is not possible to do that myself as Heroku works automatically.
In libGDX, it originally creates Gradle files into a folder specified by the user and the user imports the files into their workspace by using Gradle. LibGDX tells its users not to copy the files into the workspace for multiple Gradle reasons, unfortunately however, I did not listen in an older project.
The workspace files in Eclipse are different than those in the original Gradle build of the project, is there a way to reverse this and export the workspace files back into the original folder?
If not, can I remove the Eclipse workspace files, re-import the Gradle project the right way, and then move all the workspace files?
I have found a solution to this quite annoying issue. What I did was simply move the Eclipse project files out of the workspace in File Explorer into a safe spot and then delete them out of the Eclipse workspace using the Eclipse explorer. Then, I re-imported the original unedited Gradle project back into the workspace, not copying the files in this time like I was supposed to. Then, I went and copied the Eclipse source files out of the old and moved workspace folders and pasted the files over the source and bin of the Gradle core project files.
Note: If you deleted the original Gradle libGDX project files, just recreate it quickly using the libGDX project creator.
New to NetBeans dev here. When I first created my project and began compiling, I noticed that NetBeans had automatically created a dist/ directory under my project root and was creating an Executable JAR in that directory.
I've now been developing for several weeks, and added many resource files to my project, including a system log file, an embedded SQLite database, and several properties files. These are files that my program (a Swing app) needs to read/write from at runtime in order to function correctly.
I just noticed this morning that the Executable JAR in my dist/ directory is several weeks old, and that compiling my project doesn't update it. I am wondering if that's because there are now all these new resource files and NetBeans doesn't know how/where to package them for the automatically-created Executable JAR.
Does this mean that I'll have to tweak the build.xml myself? Or is there a NetBeans dialog I can get to where I can specify where to pacakge everything? And if NetBeans should be doing this automatically, what could be the reason that it stopped creating the JAR for me, and what can I do to force this functionality again?
I went into Project Properties >> Packaging and made sure that the JAR file directory was still dist/MyProgram.jar and that the checkbox Build JAR after compiling was still checked, so obviously something else is either breaking the build or messing with NB.
Thanks for any tips!
If "Compile on Save" is enabled, then your .jar file will only be generated when you do a "Clean & Build" (Just "Build" is not available when "Compile on Save" is enabled)
You need to Clean and Build within netbeans to update the file within your /dist directory.
I use Netbeans 7.0 and this solution works for me.
I am now doing a project using Eclipse, and I have some resource files (e.g., image, text) saved in the bin folder, and these files are needed by the program.
However, with every build, Eclipse would try to clean up the folder, then rebuild the project. When cleaning, it deletes the resource files in the folder. Is there anyway to stop Eclipse from doing this?
I know I could change the location of the files, but I am also curious why Eclipse would do this, and could this be prevented from happening.
Thanks!
Go to Options -> Java-> Compiler -> Building and uncheck Scrub output folders when cleaning projects.
That did the trick for me. In my project, I have an Ant task that adds a few configuration resources to the bin folder to include them in the classpath, without having them in src
I can't say exactly why it does it, but probably that's just how Eclipse does the build: empty the "output folder" and start compiling.
That said, if you put your files into a source folder, then Eclipse will simply copy the files over to bin on every build and they won't disappear. It will do this to any file it doesn't know how to compile, e.g. .xml, .xsd, .png, etc.
You can consider using a maven style project and add the resources to the resources folder.
Here is a link to maven directory layout.
What kind of project you are using in eclipse. You can turn off build automatically feature in the Project menu. Which would stop eclipse from cleaning up projects automatically.
Copy and paste your resources into the source folder. In eclipse, in package explorer, find your project, then paste into src. It then gives an option to copy the file or link to it. Click copy and it gets stored in /bin but won't get deleted.
In Eclipse how do I copy the Java Build Path to a different workspace?
Somebody somewhere wrote that if you copy the project then you have copied the build path also. This doesn't seem to be the case.
I've tried copying the entire workspace to a new directory. Opening Eclipse and pointing it to the new directory has all the projects and source files but the build path for my project is empty. It doesn't even have the basic Java source files to build against (java.lang.Object).
Eclipse 3.3.0 (Europa)
Any ideas?
The build path is stored in a file named .classpath in the project's root directory. I don't know of any different way, and copying the directory should also copy that file, of course. How do you copy the project? What OS?
Be very careful...
The workspace itself is just metadata in eclipse that points to your project folders. If the projects are not actually in the workspace directory, you aren't actually copying them, just references to them.
This can happen if you use "Import existing projects into workspace" that are folders in the file system without the "copy into workspace" checkbox checked, or if you create a project using an existing directory.
If you copy that workspace to a different machine, the projecs won't be there.
If you want to share projects, your best bet would be to use source/version control (subversion, for example) and have everyone hook up to the same repository.
Another note on the build paths -- if you have a java project reference an external jar, the absolute path of that jar is stored in the build path. This can be bad if other people who are sharing that project have the jar in a different location on their machine. If this happens, you should look into using Classpath variables or user libraries in eclipse.
Can you comment more on what you're attempting to do when you do the copy?