• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

NetBeans: How to store source, separate from project files, separate from class files.

 
Ranch Hand
Posts: 36
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would like to set up the director structure for my software development such that the source files, built files (classes and .JAR files), and the NetBeans project metadata are all stored in separate but semi-parallel directory structures. Is there any way to do that in NetBeans other than to start each project from "existing source"?
 
Bartender
Posts: 3648
16
Android Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Netbeans already does that for you when you create a new (Ant) project. Not sure about Maven projects.

The source files goes in the "src" folder, the class files goes in the "build/classes" folder and the jar in the "dist" folder along with any lib dependencies.
 
Grant Robertson
Ranch Hand
Posts: 36
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Perhaps I should have been more clear. I want all the source files from ALL of my projects to be in a directory structure under a single folder like this:

C:\Dev\src\com\mydomain
\mypackage1\
\mypackage2\
\mypackage3\

so that my "package root" for .java files will be C:\Dev\src for ALL projects.


And I want all of my compiled .class files to be placed under a different but parallel directory structure like this:

C:\Dev\build\com\mydomain
\mypackage1\
\mypackage2\
\mypackage3\

so that my "package root" for .class files will be C:\Dev\build for ALL projects.


And then all of my distribution files to be placed under yet another separate folder like this:

C:\Dev\dist\com\mydomain
\mypackage1\
\mypackage2\
\mypackage3\

so that my "package root" for .jar files will be C:\Dev\dist for ALL projects.

This way my default classpath can be ".;C:\Dev\dist;C:\Dev\build;C:\Dev\src" and all my packages will be together rather than spread out in dozens of different project folders, while still keeping my source separate from my class and distribution files.
 
K. Tsang
Bartender
Posts: 3648
16
Android Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah if you want to do that then your so-called Netbeans project will be one BIG project.

Just curious why put everything into one BIG project? Unless you plan to share code in whatever way possible (which probably better to use library aka its own jar file hence its own project)
 
Grant Robertson
Ranch Hand
Posts: 36
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

K. Tsang wrote:Ah if you want to do that then your so-called Netbeans project will be one BIG project.

Just curious why put everything into one BIG project? Unless you plan to share code in whatever way possible (which probably better to use library aka its own jar file hence its own project)



I know you are trying to help, but you have made an assumption that contradicts what I said in my question and then asked me why I am doing what you assumed I am doing, when I am not, in fact, doing that. ;^)

I want to be able to store all of my many project folders separate from my actual code and classes. And I want to store all my code for a particular package in the same actual folder rather than having some code for com.mydomain.mypackage actually stored under C:\dev\project1\src\com\mydomain\mypackage and some other code for the same package stored under C:\dev\project2\src\com\mydomain\mypackage. And please don't suggest that I could simply limit myself to putting all code for one package into a single project. That is a limitation I am not willing to accept.

In addition, I want to be free to use any IDE I want for any particular piece of code. If the code itself is stored under a NetBeans project folder, then it is more difficult to use that code in Eclipse or IntelliJ.

Finally, with all the source in one tree, instead of a bunch of scattered parallel trees, it is a lot easier to search for and use what I have created.
 
The government thinks you are too stupid to make your own lightbulb choices. But this tiny ad thinks you are smart:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic