Adding Java builder to .project file in Eclipse - java

I need to add a Java builder to mt .project file in Eclipse. However, there is no such file in my project folder. I don't know where this file is, maybe you can help me out?

In Eclipse, the .project file is kept in the root directory of your project, which is in your workspace. It's easy to see if you do a directory listing in your underlying filesystem. If you want to find out where your workspace is, find it by looking at the project in the Package Explorer. right-click > Properties > Resource > Location.
It might be better to use Eclipse itself to add a builder to your project, for example, using the Package Explorer - project right-click > Properties > Builders feature.

Convert the project into a faceted project. This generally happens when you import a project from git and the project is not a java project.
Steps:
Right Click -> Properties -> Project Facets
Click on convert project into a faceted project
Select the builder as java builder.

Related

Eclipse I can't link project B to project A

I work with Eclipse. I have two projects in the workspace. This is my Eclipse navigator.
I want to add AR04.CME to cmeWeb.
Folder cmeShare has some jar which I need in cmeWeb.
I click in cmeWeb properties ->Java Build Path -> Projects
This is the screen
AR04.CME doesn't appear as project.
How can I add this project?
Linking Project A to another Project B is useful when you have source code in A that you want to share to B. That's not your case. You don't seem to share source code, but a compiled library instead.
Your best option is to edit cmeWeb's Build Classpath > libraries > add jar > select your Jar library.

IntelliJ Idea generated source

Just new to IntelliJ Idea. I have maven project which has few generated source java files.
When I import that project Idea complaints about generated source files are missing but I can see those files under target/generated-sources. How can I add those files in the classpath.
You can go to Files > Project Structure and then choose your module and on the sources tab you can navigate to the generated-sources dir and click Mark as > Sources:
Additionally, folder could be assigned to the specific type from the Project panel via mark directory as context menu.
To have maven do it automatically, look here: How to create folder for generated sources in Maven?
If you are using Springboot Application.
just follow the step in IntelliJ.
Right-click on project folder.
Select maven.
Generate source and update the project folder

eclipse doesn't see java file generated during installation of maven module

I am working on a specific maven module. I have it imported into eclipse by m2eclipse plugin. The module uses our internal plugin to generate java files from some csv files. During install goal those files are being generated and put to target/generated-sources/folder_name.
Can you tell me how I can import these java files into eclipse so it stops showing me compilation errors saying that 'x' cannot be resolved to a type?
Now every module which uses those files has compilations errors in eclipse, everything works fine when I try to build from command line.
Thanks in advance.
UPDATE: Thanks a lot guys, I was trying similar solution but instead of adding source folder I was trying to add external classes :|
project -> properties -> java build path -> source -> add folder -> (search for target/generated-sources/folder_name, create it if deleted by maven) -> ok
now eclipse will only complain when you'll use mvn clean deleting target folder.
Eclipse refreshes file content on request, so any change made external to eclipse, eclipse doesn't know about that
You can make eclipse to use native hooks to detect external changes
preference > workspace > check refresh using native hooks
and add that directory to source path
You probably need to add the folder of the generated files as a Source folder in the project. Look in the Project Properties > Java Build Path > Source tab and add the folder.

How to import and run ivy+ant project in eclipse juno

this is my first use of ivy+ant and after building the project from command line, i want to import it into eclipse juno.
the project folder (trunk) contains the following folders/files:
build
dist
src
WebContent
build.properties
build.xml
ivy.settings.xml
ivy.xml
i tried to import the trunk folder that contains the above files/folder using import existing projects into workspace, but i get the error that no projects found.
pleases advise how to import this project.
UPDATE: i tried to configure the project for eclipse before importing using the following command:
ant eclipse-default
but i get the following error:
Target "eclipse-default" does not exist in the project
UPDATE 2:
i was able to import the project in eclipse as follows
File > New > Other > Java Project From Existing Ant Buildfile
but when trying to run the project on server, i can't find run on server in the run options, please advise.
You may try this:
Install IvyDE from http://www.apache.org/dist/ant/ivyde/updatesite (ref: http://ant.apache.org/ivy/ivyde/download.cgi)
IvyDE may not recognize your setting and properties file. At Window -> Preference -> Ivy -> Settings, check reload the setting on demand, add Ivy setting path ivysettings.xml or your Ivy setting file, Property files build.properties or your Ant properties file.
Add new Java project you want to work on, point the path to your project.
At the new project wizard, Libraries tab -> Add Library -> IvyDE Managed Dependencies.
You can not import a project of you do not have the eclipse project information in your code.
Either create a new eclipse project from existing source.
Or a new java project from ant buildfile (your update 2).
For running need configuration of server (hard to know what youneed there), you may need to create new server (preference/server/run time environnement) (or from view server, right click "new")

Importing projects with Eclipse so new stuff I add will go to the source directory as well

When I do File -> Import, General (from the pop-up window)->Existing Projects into Workspace, I can browse to where all my projects are and import them so my Eclipse workspace folder with its .metadata is in a separate location from my source directory.
The problem is, if I add a new project or even add a new file within an existent project, the new files get made in my Eclipse workspace folder, not over where the other code lives.
How do I tell Eclipse to put new code in the source directory, not in the workspace directory? When importing, I did not check the checkboxes "Copy projects into workspace" or "Add project to working sets" (Add project to working sets requires the selection of working sets, which I don't know about).
It depends on the kind of project you are creating. For example, a "Project" type project that just contains dumb files lets you uncheck the "Use default location" option and will actually be created in whatever directory you give it.
Java projects, on the other hand force you to create them in the workspace.
For project types that eclipse will only create in the workspace you can use the following workaround.
Create the project in your workspace.
Delete the project from eclipse without deleting the files on disk.
Use your OS tools to move the project folder where you want it.
Back in eclipse: File -> Import -> Existing Projects into Workspace
Browse to folder containing your relocated project.
Make sure to uncheck the "Copy projects into workspace" option

Categories

Resources