How to import two projects in Eclipse, like one - java

I have problem with importing two Java projects in eclipse like one.
I have one zipped file with 7z extension.
Zipped file structure:
trunk ->
Server -> all server files
Datapack -> all datapack files
So, extract files from zipped folder and trying to import trunk folder to eclipse and i get two different projects (Server and Datapack) and i can't apply diff patch, becouse thease two projects should be in trunk folder.

The other suggested answers so far will destroy the configurations that are already in each project. You can avoid this problem by importing the two projects separately and adding one project to the other project's build path. Specifically, try these three steps:
1.) Import both projects separately into eclipse
2.) Right click on the server project in eclipse, select Build Path...Configure Build Path
3.) Add the datapack project to the server project's build path.
You will then be able to access all of the datapack's functionality from within the server project, as if the projects were merged.
This approach will retain any pre-existing project configurations that may be essential to the project function.

you can solve this by creating an empy project ! then copy both folders into sources , like this you have all resources in one project , unless you are using maven then you need to merge the pom.xml files

You should try creating a new project and merge both projects into it.

Related

How to add project instead of jar in vscode?

I have a gradle wrapper based java project A in which I am using jar of another project B.
I want to debug a code of jar project B while running A.
This was easy in Eclipse as we just need to add project B to current project A in workspace and adjust the import order.
Is there any way to achieve same in VSCode ?
Make project and Jar be stored in the same one folder then open the folder in VS Code. The folder can be a new workspace.
Reference: Workspace in VS Code

How to add project of different workspace into the current workspace in Eclipse

I have two workspaces and I want to use java file as a parent class or you can say extends it from workspace2 to workspace 1 in eclipse, how can I do this?
As I can add project from same workspace but unable to figure out from different workspace.
I dont want to import the project.
Thanks in advance
You can make New File -> advanced options and Link to Folder in the system where the class is
You need to import your project from workspace 2 to workspace 1.
You can reference your project in another workspace in the build path configuration of your project, linking two eclipse project, even if they are in different workspaces.
If you want the code to be available for changes this are your options:
You have to either import the project or create a new workspace that includes them all.
Note that you may extend the java class from the same project or from another project within the workspace, but not from another workspace.
If you are willing not to have the code in front of you available for changes, you may build the first workspace' project into a jar and then use that as part of your other workspace.
Way 1
You can add the second project's src folder to the current project and you can add them in your project.
Right click on project -> Build path - > source tab - > link source
Way 2 :
Make that external project as a jar and add as a dependency.

How does one export and then import an exact copy of a java project jar?

I have tried various things starting with Java Maven project to get a jar which when imported looks exactly like the original but I have found that I can't for example get the src/main/resources folder to appear in the imported project. The goal is simple: so that on the new machine for example that the project can be run and worked on just like the original. Not sure what I am missing. I have tried importing existing project from archive which seems like it should work. On the original machine I select all files and folders but this still leaves out some things. I have tried to create an empty folder in Eclipse but this can't be done and various permutations.
A jar file usually contains compiled code and whatever else you drop in there which in turn enables you to run the code.
An eclipse, maven, intellij, ... project structure may be completely different. In the end a transformation will happen from that project structure to the jar content structure. In the case of Maven this will not be the same as the project structure.
The intent of a jar is running the compiled code, an intent of a project structure is to edit the source code.
If you want to copy an eclipse workspace to work on then do so. Copy the workspace folder.
user392486 basically showed what to do. The key is to export the file not as a jar but as a zip and the import it as an existing project which has an archive option. that works just as one would want, an identical project. how i could not already know this is beyond me...

How to transfer my Eclipse Maven Selenium Webdriver TestNG Java project from one PC to another?

I am working at a place, but sometimes I bring some work home.
The problem is, however I try to export my project from my work computer and use it on my home computer, I get all kinds of errors, missing files and so on.
Is there a way to transfer the project flawlessly?
What kind of additional information should I provide?
I've tried exporting to a JAR. Importing fails
I've tried moving the whole project folder, and opening an existing Maven project - fails.
Just remove the class path file. Zip the entire folder and take it. Ensure when importing into your other eclipse import it as a maven project and not as just a simple java project. Your class path file contains all the path of the src and jar folders. since the path will be different in your other system you will get such errors.

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