What? Why? Where? When? Which?
-
1
-
-
-
-
If you are doing this for yourself, then you are the judge of right or wrong, but if you are doing this at work, then your work standards should be implemented.
Rajeev Pedada wrote:Hello all. Pic shows the project directory which I used for my java project(without IDE). Just tell me whether the structure is correct or not i.e keeping localization files in localization folder, postgres jar file in database folder , dbconfig.properties file in config folder etc
Out on HF and heard nobody, but didn't call CQ? Nobody heard you either. 73 de N7GH
-
1
-
-
-
-
Personally, I'm a fan of keeping localization and configuration files in a hierarchy that reflects the packages where they are used.
For instance, if you have a package that deals with persistence, let's say tld.company.project.repo, then I would put my DB configuration in a file src/main/config/tld/company/project/repo/db.properties, and add src/main/config as one of my project's resource folders.
Whatever you do, be consistent.
The mind is a strange and wonderful thing. I'm not sure that it will ever be able to figure itself out, everything else, maybe. From the atom to the universe, everything, except itself.
Stephan van Hulst wrote:Maybe you can elaborate Carey, I'm not sure how this relates to OP's question?
There appears to be a test package next to the customexception and service packages.
SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
What? Why? Where? When? Which?
-
1
-
-
-
-
When running tests, you should add both the compiled main classes directory and the compiled test classes directory on the classpath. When running the application, only the compiled main classes should be on the classpath.
If you're really using Maven, all of this happens automatically and you don't have to worry about it.
The mind is a strange and wonderful thing. I'm not sure that it will ever be able to figure itself out, everything else, maybe. From the atom to the universe, everything, except itself.
-
1
-
-
-
-
After compilation, Maven puts these files here:
The mind is a strange and wonderful thing. I'm not sure that it will ever be able to figure itself out, everything else, maybe. From the atom to the universe, everything, except itself.
Stephan van Hulst wrote:It appears you're using a Maven project layout.
Personally, I'm a fan of keeping localization and configuration files in a hierarchy that reflects the packages where they are used.
For instance, if you have a package that deals with persistence, let's say tld.company.project.repo, then I would put my DB configuration in a file src/main/config/tld/company/project/repo/db.properties, and add src/main/config as one of my project's resource folders.
Whatever you do, be consistent.
For Maven to pick it up properly, that should be src/main/resources/tld/company/project/repo/db.properties
That will cause the properties file to automatically be copied into target/classes/tld/company/project/repo/db.properties without any additional tweaking of the POM.
An IDE is no substitute for an Intelligent Developer.
src/main/resources/WEB-INF/classes/tld/company/project/repo/db.properties
An IDE is no substitute for an Intelligent Developer.
The mind is a strange and wonderful thing. I'm not sure that it will ever be able to figure itself out, everything else, maybe. From the atom to the universe, everything, except itself.
