How to maven multiple directories in java? - maven

Im having 2 seperate packages under src folder. i wonder how to maven this project?
src
-- com.firstpackage
-- com.secondPackage

As long as they are in one src folder this should not be a problem.
Your typical maven project will look like this:
my-app
|-- pom.xml
`-- src
|-- main
| `-- java
| `-- com
| `-- mycompany
| `-- app
| `-- App.java
`-- test
`-- java
`-- com
`-- mycompany
`-- app
`-- AppTest.java
So even if you have many packages/folders within src/ that should be no problem.
There is a good guide here how to set up a maven project in 5 mintues.

Related

what does Spring Boot multiple modules project's classpath look like?

I am developing a multi-modules project with Spring Boot, and it always confuse me that what does its class path look like .
My project looks like this:
project
|-- module1
| |-- src
| | `-- main
| | |-- java
| | `-- resources
| | |-- /params/applicationContext.xml
| |
| `-- pom.xml
|-- module2
| |-- src
| | `-- main
| | |-- java
| | | `--GetPropertyUtils.java
| | `-- resources
| | `-- /params/batch-jobs.xml
| `-- pom.xml
If Module1 is my web module and module2 is a CommonUtil module,
When the server is started, are two property files(batch-jobs.xml and applicationContext.xml)' classpath the same(which are /resources/params)?
Ist there any document I can learn from?

How to configure Gradle for a Kotlin multi-platform project with multiple targets?

For my Kotlin JVM project I have 2 different implementations for expected declarations of classes/functions. I'm using Kotlin multi-platform features with the expect/actual system. Here's the project structure:
|-- actual1 (sub-module)
|-- src/ (actual declarations for the first target)
|-- build.gradle
|-- actual2 (sub-module)
|-- src/ (actual declarations for the second target)
|-- build.gradle
|-- src/ (common code + expected declarations)
|-- build.gradle
How should I go about configuring Gradle such that I can switch between using actual1 or actual2 at compile time with for example a compiler flag?

Spring CLI generates unexpected project structure

When I generate a project with the webpage https://start.spring.io/ and with the configuration: ["group: com.foo", "artifact: bar", "build: maven", "spring boot version: 1.4.2"] I get the following project structure:
folder-name/
|-- mvnw
|-- mvnw.cmd
|-- pom.xml
|-- src
|-- main
| |-- java
| | |-- com
| | |-- foo
| | |--BarApplication.java
| |-- resources
| |-- application.properties
|-- test
|-- java
|-- com
|-- foo
|--BarApplicationTests.java
And when I generate a project with the Spring CLI command:
"spring init -g=com.foo -a=bar -name=bar --build=maven foo-bar" I get the following project structure:
folder-name/
|-- mvnw
|-- mvnw.cmd
|-- pom.xml
|-- src
|-- main
| |-- java
| | |-- com
| | |-- example
| | |--BarApplication.java
| |-- resources
| |-- application.properties
|-- test
|-- java
|-- com
|-- example
|--BarApplicationTests.java
Whatever config I use with Spring CLI. I always get the folder structure "src/java/{top-level domain}/example".
Why is the folder after the top-level domain always named "example", how do I avoid this so that it uses the group and artifact properly so that I get: "src/java/{group's top-level domain}/{group's domain}"?
I guess -a and -g are not correct spring cli params. Only name works fine.
Please referr to How do I use the Paremeters listed in spring init --list.
Specifying the --package-name parameter solved it.

Can't create unittests IntelliJ

I am not able to select my testfolder in IntelliJ.
For some reason it wasn't there when I created this project, so I added it manually. After I did that, I went to project structure --> modules, where I marked it as a test.
I am simply not allowed to leave my source directory, when creating a testcase.
See image:
The problem doesn't occure when I create a new project, where the testfolder is set automaticly.
It seems that you have wrong project structure.
It should be as follows:
project-name
|-- pom.xml
|-- src
|-- main
| |-- java
| |-- resources
|-- test
|-- java
|-- resources
And don't mark the test directory as a test source root. You should mark the test/java (subdirectory under the test folder) instead:

Rails 3.1 asset pipeline vendor/assets folder organization

I'm using the jQuery Tools scrollable library in my Rails 3.1 site with the various assets placed in the vendor/assets folder and it works great.
My question is regarding the best way to organize the various files under vendor/assets. What is the recommended way to organize vendor/assets subfolders? Currently I have this structure:
vendor/assets/
|-- images/
| |-- scrollable/
| <various button/gradient images>
|-- javascripts/
| |-- scrollable/
| jquery.tools.min.js
|-- stylesheets/
| |-- scrollable/
| scrollable-buttons.css
| scrollable-horizontal.css
This is a fairly un-DRY what to do this. I feel that all of the 'scrollable' items should be under one folder.
What is the recommended way to do this without having to manipulate the asset pipeline load paths?
Thanks!
You could organise them this way, which is slightly better in that it keeps stuff related to the plugin in one directory:
vendor/assets/scrollable
|-- images/
| |-- <various button/gradient images>
|-- javascripts/
| |-- jquery.tools.min.js
|-- stylesheets/
| |-- scrollable-buttons.css
| scrollable-horizontal.css
I am pretty sure this will work as rails globs all directories under assets/.

Resources