Use Java source dirs from ant build.xml to configure Netbeans project - java

I have an existing Java project with an ant build.xml and I'm trying to use Netbeans as my IDE.
In Netbeans I've created a new Java Free-Form Project and pointed it at my ant file. This works fine for building, running, etc. However code completion does not work unless I manually add all the java sources for my project (that are already defined in my own build.xml!) via the Netbeans project properties "Java Sources" tab. This is very tedius because this project has has many source dirs.
Is there a way to get Netbeans to recognize the source dirs that are already defined in my ant build.xml to get functionality like autocomplete working?

Netbeans stores the project information in project.xml file not to modify build.xml.
You can set code completion for your case. For this:
- do right click on your project and select ‘Properties’
- click on ‘Java Source Classpath’ in ‘Categories’ panel
- check ‘Separate Classpath for Each Source Package Folder’
If you want to add new source folder select ‘Java Source’ in ‘Categories’ panel and then click on button ‘Add Folder...’

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.

Eclipse Launched Maven project not using classes in the \target folder

I have a project which I am converting from plain Java to Maven.
I used the "Configure -> Convert to Maven Project" option in eclipse.
I removed all jars in the classpath and referenced them in my POM file and built the project
My new classes are built in project/target but when I launch from eclipse, (using the original launcher) , the old classes are in project\bin folder are used.
How do I reconfigure this to use the correct classes ?
Seems that the configuration for output files in eclipse has not change.
Try to change the output of generated files in eclipse manually:
Right click in project -> Properties.
Select "Java build path" and tab "Sources".
At bottom you have a field named "Default output folder". Change it for: <your-project>/target/classes
For example:
Hope it works.

Exporting project in eclipse only exporting .classpath and .project

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

The project uses build.properties from another NetBeans installation

When using trying to build a NetBeans project created with a previous version, I get the following confirmation dialog:
Build Project
The project ... uses build.properties from another NetBeans installation.
Build Anyway
Use this installation
Update
What would these options do?
No matter which options I choose, I do not notice any difference in the build process.
Using NetBeans Development with projects created on NetBeans 8.1.
it depends on what type of dependencies you are using in your project, to be on safe side , I'd prefer clicking Update which it'll update current project's build properties with the external one,
also here's what (wiki.netbeans.org) have about build.properties file:
"If you edit build.xml by hand, you can of course arrange to build other projects (or any Ant scripts) as part of your build, using the or tasks. Note that a build-impl.xml, when building a foreign project, calls its build.xml (rather than skipping to its build-impl.xml), so you can freely mix a hand-customized project with IDE-customized projects."
thanks

What does netbeans or any IDE look for when importing a project

I tried to use a project not made using netbeans. I tried to use it by creating a new project and using the "web application with existing resources". When browsing for the existing project, I clicked on the project name and clicked OK, but it opens the project and shows the list of folders in the project and doesn't accept the projectnamefolder as the project to be imported.
What does an IDE look for the identify a project as a project that can be imported
Eclipse looks for .project files when importing existing eclipse projects. If you create an eclipse project for existing code, you can simply create a project and point it to the right folder, and specify the layout for source and target.

Categories