I have a citrusframework test, which when run with
mvn verify
it is able to find a json template file which is required to run the test, but when run with
mvn test -Dtest=SampleXmlIT#saveGroupTrips
suddenly it throws me following error:
Caused by: java.io.FileNotFoundException: src/test/templates/json/api/config/saveGroupTrips.json (No such file or directory)
my folder structure is as follows:
citrus-scada
|-src
| |-main
| |-test
| |-java
| | |- com : *.java testclasses
| |
| |-resources
| | |-com : xml-files which describes the testcases and reference the files required
| |
| |-templates : referenced files
|-target
does the working directory change?
src/test/templates is no Maven Standard Directory so there must exist some configuration which adds it to the classpath for test.
Because your test is named SampleXmlIT (IT is the important part, see here why) the test is executed with maven-failsafe-plugin in phase integration-test when you execute mvn verify
Now you call mvn test -Dtest=SampleXmlIT#saveGroupTrips but now it is executed with maven-surefire-plugin.
If you want to execute tests isolated with maven-failsafe-plugin try:
mvn verify -Dit.test=SampleXmlIT#saveGroupTrips
See also here
Related
we are using Quarkus with gRPC and some internal library that also uses the same protobuf data. So the dependency graph looks as follows:
quarkus-project
|
+--> lib
| |
| +--> my-protocol.proto
|
+--> my-protocol.proto
Our current solution is a maven artifact (my-protos) that wraps the my-protocol.proto and also includes the generated sources from that.
As Quarkus also needs the raw *.proto file to generate Mutiny wrappers around it, we also include my-protocol.proto via git submodule, s.t. we end up with the following structure:
quarkus-project
|
+--> lib
| |
| +--> my-protos
| |
| +--> my-protocol.proto
| +--> <generated sources>
|
+--> <git submodule> my-protocol.proto
|
+--> <mvn exclude> my-protos // are generated by quarkus again
The compiler checks that the classes to be generated from this proto are already present. So we had to exclude the dependency my-protos via maven dependency management.
Works inside IDE, all classes are present.
BUT as soon as we run Quarkus in dev mode (mvn quarkus:dev), the QuarkusClassLoader throws a ClassNotFoundException when we access a protobuf-generated class inside of the library-code. Checking the stacktrace, we see that the class we are trying to load is a banned dependency. We assume this is caused by the <exclude> in the pom.
Accessing the same class from code that is witten inside the quarkus-project, we do NOT see the exception.
So our best guess is that we are currently dealing with different classloaders (see [1]). The classloader, which is responsible for loading the libseems to have the banned dependency, the other one not.
This explanation is confirmed by running quarkus in production mode (where only the system classloader is used) and there we do not have the banned dependency problem there.
Please send help :)
[1] https://quarkus.io/guides/class-loading-reference
I'm implementing test suite for brand new go app and decided to use ginkgo. The app has main function and several packages
.
|- main.go
|- types
| |-- user.go
| |-- post.go
|- server_pkg
| |-- users_controller.go
| |-- posts_controller.go
|- worker_pkg
| |-- users_worker.go
| |-- posts_worker.go
I ran ginkgo bootstrap in each package folder and added test files using ginkgo generate. Now I'm able to run tests for each package separately i.e.
cd server_pkg; ginkgo
The question is that: how to configure my application to run all tests for main function and packages using single command?
I can chain commands like ginkgo; cd server_pkg; ginkgo ..., but it does not look like good solution.
To run all test suits you should run this in command in your root catalog
ginkgo -r
Also is good practice as in normal test suits to run all test with race detector, also you could shuffle some test. You can run all this option by using
ginkgo -r --race --randomizeAllSpecs --randomizeSuites
#ttomalak thank you! It's exactly what I wanted
$ ginkgo -r
I have a multi-module Maven project (one level deep only). I like not to have to repeat the same things in all child projects, but how can I still do it (avoir repeating) when the parent project itself needs a different setting ?
The example I’m facing is when trying to produce a common folder for all artifacts and dependencies (but I can imagine other equivalent situations):
<properties>
<__.build.folder>../last_build</__.build.folder>
</properties>
Of course, this will lead to a situation where I have two last_build folder, one common to all child projects, one in the upper level folder.
How can I avoid that without having to duplicate the same setting in every child pom.xml ?
Can I use profiles ?
I don’t know, I’m new to Maven.
Thanks
Edit :
In this example, last_build is a subfolder of the folder containing the parent pom.xml. The child projects are all in other subfolders, from which last_build has to be addressed as "../last_build" - but not in the parent pom.xml !
|
*--rootFolder
| |
| *--last_build // aggregation folder
| |
| *--subProject1
| | |
| | *--pom.xml (../last_build)
| |
| *--subProject2
| | |
| | *--pom.xml (../last_build)
| |
| *--subProject3
| | |
| | *--pom.xml (../last_build)
| |
| *--pom.xml (last_build) // different here for the parent project
I don't think you're proceeding down a very useful path and I think that you may be confused about a few things.
First, at the highest level, your root or parent pom, there should be no project, no code, no resources, and no artifact, so there should also be no output or need for an output directory. All you should have at the highest level is the parent pom and subdirectories containing modules.
The next problem is that you think you need a common build folder. I am hard pushed to imagine a rational scenario where that would be necessary. The artifacts one typically builds in maven are self-contained jars/wars -- one per module, and these are cached in the local repo whenever you build through the install lifecycle. They can be used in situ from there.
I created two projects(PROJECT-1,PROJECT-2) in the directory and i would like to execute both the projects in one click for that i create another project(PROJECT-3) in the directory and present these two projects((PROJECT-1,PROJECT-2) as modules and define packaging as pom Here i am using modules concept.
<modules>
<module>D:/20-6-2014/PROJECT-1</module>
<module>D:/20-6-2014/PROJECT-2</module>
</module>
I define the PROJECT-3 as parent for both the projects,while i run the PROJECT-3 it gives an error.
Error is: Child module D:\20-6-2014\PROJECT-3\PROJECT-1 of
D:\20-6-2014\PROJECT-3\POM.XML does not exist.
your directory structure should be like as follows PROJECT-3 is your parent project for PROJECT-1 and PROJECT-2
|
|
----PROJECT-3
|
|
----pom.xml
|
|
----PROJECT-1
| |
| |
| ------pom.xml
----PROJECT-2
|
|
-------pom.xml
and PROJECT-3's pom.xml should have
<modules>
<module>PROJECT-1</module>
<module>PROJECT-2</module>
</module>
Running mvn idea:idea to generate IntelliJ IDEA project files we stumble into a folder that must be avoided, let's say .avoidMe, which is located inside every folder as a placeholder.
folder1
|
+- .avoidMe
|
+- folder2
| |
| +- .avoidMe
|
+- folder3
| |
| +- .avoidMe
. . .
I've looked at idea:idea exclude options but none of them accepts wildcars (e.g. .avoidMe , "/.avoidMe/" or else ) so that I need to add every possible path to the exclude property ( e.g. folder1/.avoidMe,folder1/folder2/.avoidMe,folder1/folder3/.avoidMe )
The idea here is to use it to run IDEA inspections and publish the results into Sonar.
Is there any way to exclude file search using a wildcard or any other trick than exhaustive path search ?
are there any other ways to run IDEA inspections and publish them into Sonar ?
You should never use mvn idea:idea, it's obsolete and was not updated for years. It's also known to generate incorrect projects with the bugs that will be hard to trace later.
Instead, just import pom.xml in IDEA, project files will be generated by IDEA automatically.
You can then Exclude certain folders in Project Structure | Modules | Sources. Be aware that this configuration will be lost on the next reimport.
There is another configuration to exclude folders that is global and will be not lost on reimport: Settings | File Types | Ignore files and folders.