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:
Related
I'm trying to get started with Sidekick for Dapr, and am having trouble telling Sidekick where the dapr components are.
By default it's going to %USERPROFILE%.dapr\components, but I'd rather it go to a folder local to the solution.
Looking at the code it appears that adding the following to the appsettings.json should work, but it isn't picked up.
"DaprSidekick": {
"RuntimeDirectory": "dapr",
"ComponentsDirectory": "C:\\Dev\\DaprPOC\\components",
}
However the components folder invariably becomes %USERPROFILE%\.dapr\components
Any help on how I specify the component locations with Sidekick?
When you set "RuntimeDirectory": "dapr" Sidekick will automatically look for component files in the dapr/components subdirectory in your solution. Try removing the ComponentsDirectory entry so it returns to defaults, and try a directory structure like this:
|-- MyProject
| |-- MyProject.csproj
| |-- dapr
| | |-- config.yaml
| | |-- components
| | | |-- my_component.yaml
The Dapr Sidecar should then load my_component.yaml.
You can also manually add the components directory in the dependency injection:
services.AddDaprSidekick(configuration, p => p.Sidecar =
new DaprSidecarOptions() { AppId = "daprservice", ComponentsDirectory = "C:\\Dev\\DaprPOC\\components" });
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?
I have created a simple maven project with a parent pom and a module pom. When i execute a mvn clean install i notice that the parent and the module are in the same level.
Structure of the project in the local repo:
-parent folder
-module folder
While I expected something like that:
-parent folder
+—-module folder
Is this normal ?
What happened if two modules have the same name in this case ?
Assuming you are talking about the local repo usually located at ~/.m2/repository, yes, that is normal. You have to distinguish between the folder layout within the repository and the folder layout for your development.
As mentioned in this question, the artifacts are always in a folder structure according to their coordinates (groupId, artifactId and version).
groupIdSplitAtDots/artifactId/version
Whether some artifacts are modules of another is completely irrelevant for the directory-layout of the local repository.
If you have e.g. the artifacts com.organisation.topic:artifact-parent:1.2, com.organisation.topic:artifact-module1:1.2 and com.organisation.topic:artifact-module2:1.2, the folder structure will be:
com
|-- organisation
|-- topic
|-- artifact-parent
|-- 1.2
|-- artifact-module1
|-- 1.2
|-- artifact-module2
|-- 1.2
Note, that for development it is usually a good idea to have the parent module in a parent folder, resulting in a layout like this:
artifact-parent
|-- artifact-module1
|-- artifact-module2
As per your second question, identical module names (artifactIds) are not allowed. Regarding the artifactId the docs state:
The identifier for this artifact that is unique within the group given by the group ID.
I am new to gradle so this question may be silly, but i have a project configured with the 'java' plugin like so:
apply plugin: 'java'
and it has a file structure like so:
src
`-- test
|-- java
| `-- com/example/Test.java
`-- resources
`-- com/example/test.txt
When i run gradlew testClasses (or processTestResources more specifically) the Test.class appears in the build folder but the test.txt does not get copied. am I missing something? my understanding is that this should be standard behaviour. do i need to include it in the CopySpec?
I am running gradle 1.10
After a brief look at my build directory for the project, I noticed there is a seperate folder for resources apart from classes. So it is copying there.
from what I understand the resources folder is available on the classpath at runtime, But I was expecting the physical (meta-physically speaking) file to be in the same directory as the Test.class file in my code. hence my question.
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.