Exporting project in eclipse only exporting .classpath and .project - java

I imported a git folder https://github.com/TeamLapen/Vampirism.git ((If you were wondering)). And so now I have it within my eclipse workspace, but not "really". Here's what I mean: The project shows up in the tree on the left of the eclipse window, but the folder itsself is NOT located in the /workspace/ like the other projects.
All I did in the code was change a few lines to fix a bug, as is highlighted below.
Anyways, when I go to export the file (File > Export > Jar), a few things happen:
In the box on the left, you see the project name is "Vampirismx". In the middle box, you see that the project is NOT AVAILABLE FOR EXPORT. In the right box, you see the only files "available" for export are the classpath and project files.
Can someone help me?
Tl;dr
I imported an eclipse project from git. When trying to export it, the project isn't showing up.

looking at the git repository, it does not provide eclipse project settings, and indicates only step by step instructions for intelliJ.
So when you imported it into eclipse, you have it on your workspace like a plain project, not a java one and that is why trying to export it as JAR does not shows up.
You must indicates that the project is a java project and it should work.
also, i'm not familiar with gradle, but seams there is a goal for settings things in eclipse : https://github.com/TeamLapen/Vampirism#setting-up-vampirism-in-another-environment

Related

How do I make an executable file from an intellij idea project?

I created a gradle project in Intellij idea. After building and running everything worked as expected. But I don't want to run an IDE everytime I need to use my program. Can anyone recommend a step-by- step guide?
You can quickly do it in IntelliJ following theses steps :
Go to File > Project Structure
Select Artifacts tab and click on the "+" icon
Choose to generate a JAR from modules with dependencies
Choose your module and its main class and save changes
Now go to Build > build artifacts > build*
It's done, your executable .jar file should be located in out/artifacts/module_name/module.jar
*Choose rebuild if it has already been built.

Jar files grayed out in Eclipse

I have a java application in eclipse and the thing is that some of the jar files within the project are grayed out.
What does this mean?
The project runs as expected and they are set correctly within the build path.
These (JAR) files are not under version control (if using Git, these files has been added to .gitignore, e. g. via right-click Team > Ignore).

Moving from NetBeans to eclipse, can't seem to find generated java files

I have been developing in NetBeans, I am exploring changing over to eclipse.
We have a set of directories for the modules in our project; we have scripts that check things out of Subversion and do other things with that directory tree, and we have NetBeans access the sources, etc., from that directory tree.
All our modules are built, etc., with Maven. All of this works fine from within NetBeans.
I have successfully imported all the projects into eclipse (File / Import / Maven), but evidently something is different in the handling of "generated sources". We have some castor-generated files in one module, and jaxb-generated files in another. The generated files in both cases are not found by the compiler, and therefore these modules have compile errors.
Maven is configured to generate the Java classes which cannot be found; maven clean deletes them and maven compiler:compile puts them back. But in eclipse those java files cannot be found for compiling other classes, but in NetBeans they can.
I tried deleting the generated java files, then rebuilding in eclipse; the java files were regenerated in generated-sources, but still cannot be found by the compiler when it comes time to compile (or syntax-highlight) my code.
It sort of looks like a classpath issue, but we don't set the classpath in NetBeans for a maven project. How should I configure things in eclipse so the generated class files are found?
In Eclipse in the Package Explorer right click the project folder which contains the missing files. Goto "Build Path >" then "Configure Build Path...". Properties for your project folder will open.
Click on the "Source" tab. Then click on the "Add Folder..." on the left. A source folder selector box opens, here select your folder which contains the auto generated sources. Normally it will be in the target directory. Then press ok. If this will not work, try one directory deeper or less deep.
If there is no target directory, build the project folder with maven on a shell.
The generated-sources directory will be stored in the .classpath file in your project folder.
HTH.

Can you import a non-archive project directory in Eclipse?

I read this article which shows how to import/export projects in Eclipse (although it seems a little outdated and I'm using 3.7 Indigo).
To export a project, you go to File >> Export and it creates some kind of "project archive" file on the local file system. You could then email it to someone else, who could then import the archive as a new project or into an existing project.
But what if you don't have an "archive" file to begin with?!? What if you just have the project files and directories but without all the Eclipse-metatdata (.project file, etc.)? Is there anyway to tell Eclipse to look at, say:
/home/myuser/some/path/to/project/root/
src/main/java
SomeObject.java
build.xml
...and get it to read that as a new Java project?
Try the steps below:
Create a Java Project in Eclipse as below:
Load the project contents from your file system as below:
Hope this works for you.
.project and .classpath files are the base of the project structure. Without a .project file Eclipse won't recognize your project. The .classpath is important too but that one changes between environments. Should you use the files from another environment you'll have to reconfigure some settings.
Rather than emailing code, I suggest you use a Version Control system and, also, some Eclipse plugins. SVN + Subclipse for example.
If you trully want to send the project to another person just send him the project's folder and import it as an existing project by doing right click on the project explorer and selecting Import > Existing Project into workspace.

After building the project from pom.xml using Maven, how do I use its resources

It's been tedious. This is the API I am trying to use. Its resources were set up in a pom.xml which I built using Maven. On built up, it gave me the project socrata-publisher that has
src/main/java the source folder with packages com.socrata.api com.socrata.data, com.socrata.util where each contains only .java
files
JRE System Library and Maven Dependency hierarchies where each contains a number of jar files
Problem is com.socrata.api and the 2 other contains classes which I want to deploy in a project outside socrata-publisher. I tried using import com.socrata.api but it didn't work. Moreover, since its a Java project and not android it doesn't have the is Library option in preferences which could rather give me the solution. Both socrata-publisher and tutorial (where i want to use the resources and which is the android application) lie in the same directory eclipseApps in My Documents.
Here's a little visual queue. Help will be greatly appreciated.
You will need to first of all get the output of the socrata project and all its dependencies.
In command line, going to the project folder of the socrata project, where the pom.xml file is, run MVN INSTALL. You shall see a jar file called socrata-api.jar in $HOME/.m2/repository. If you are using windows and installed MAVEN by default, $HOME should be your user profile folder. Once you see the jar file, add it to your tutorial build path.
I think what you actually want to do is just set up the "socrata-publisher" as a project dependency for your "tutorial" project. That will allow you to reference the built Socrata libraries from the code in your project.
Right click on the project and select "Properties". From within that dialog select "Java Build Path" on the left, then the "Projects" section, and click the "Add" button to add the "socrata-publisher" project.
I think that'll work better than creating a separate jar file that you then include, and then you can also keep the socrata-publisher code up to date using Git.

Categories