In our Spring boot Java project we are having flyway migration scripts. Below is our project structure,
Project
|
|
+-- src
| |
| +-- resources
|
+-- db.migration
|
+--V1_0_db_script.sql (scheme_one)
+-- test
| |
| +-- resources
| |
| +-- db
| |
| +-- data-test
| | |
| | +--V1_0_test_db_script.sql (scheme_one)
| +-- data-sql
| | |
| | +--V1_0_sql_db_script.sql (scheme_second)
| |
+-- application-test.yml
Now, here is my application-test.yml structure.
Flyway :
enabled: true
schemas: scheme_one
locations:
- classpath: /db/data-sql
- classpath: /db/migration
- classpath: /db/data-test
Now, what is needed here is that while running test cases, it should execute data-sql directory first it means V1_0_sql_db_script.sql should execute first then db.migration and then data-test directory. But its not executing in the order which defined in location (My assumption is from top to bottom, even I tried bottom to top).
Now what's happening, it always first executing db.migration which is located under main src package. But I want to execute data-sql directory scripts first anyhow while test cases are started to run as there are some queries which is needed for other scripts. One more thing, there are actually two different schemes used. I have defined in brackets.
Kindly suggest if flyway have any property to define order or any other feedback will be appreciated.
Related
I have the following Maven project structure with Junit and Cucumber:
| root project
| Module 1
| src
| main
| test
| java
| tests // where all step definitions from Module 1 are stored
| resources
| features // feature files from Module 1
| Module 2
| src
| main
| test
| java
| tests // where all step definitions from Module 2 are stored
| resources
| features // feature files from Module 2
I want to reuse the steps from Module 1 in Module 2. Is it possible to import step definitions from Module 1 to Module 2 to reuse them there?
What you are already doing is kind of correct approach. You need to consider the following:
Since your Step Defs are in test the are not transitively take part in module2 class path
Make also sure there that the step defs in module1 are in a proper package relationships to your module2: your runner class in module2 is in the same package or above than your feature file which is in the same package or above than your step definition class
Make sure that module2 has module1 as a dependency
So to remediate point 1 in your example you need to move your step definition in module1 from test to main
I want to exclude a specific file from the base jar while running my project (which will use the base jar as dependency)
Base project structure looks like:-
baselib
|
|----src
| |
| |--some packages
| |
| |--resources
| | -- somefile.xml
|
|---target
Another project called "mycustomproject" will have "baselib" as dependency jar in pom.xml
My question i,s how to debug/run (Debug As/Run As-> Spring Boot App) the "mycustomproject" by excluding "somefile.xml" alone. I cannot remove this file in "baselib" since some one is using it.
Could someone share some inputs here?
I'm trying to configure Camunda automatic resource deployment for a multimodule project. What I want to archive is that for the following project structure:
\---learnCamunda
| pom.xml
+---application
| | pom.xml
| +---src
| \---main
| +---java
| | \---com
| | \---camunda
| | \---learnCamunda
| | | LearnCamundaApplication.java
| | \---configuration
| | CustomOracleDialect.java
| | FlywayConfiguration.java
| | H2ConsoleConfiguration.java
| \---resources
| | application.properties
| |
| \---processes
| loanRequest.bpmn
+---contract-management
| pom.xml
\---src
\---main
+---java
| \---com
| \---camunda
| \---learnCamunda
| +---dto
| +---dts
| +---entity
| \---enums
\---resources
\---processes
DUMMY_PROCESS.bpmn
where application and contract management are modules of learnCamunda project, I want my application.properties to provide classpath for Camunda resource scan to pickup both loanRequest.bpmn and DUMMY_PROCESS.bpmn. Is that possible via application.properties in application module? (The application module has dependency on contract-management module)
If it is possible then which camunda property -- should I set it and to what?
I have already tried different combinations of deployment-resource-pattern but non of them worked.
EDIT:
One thing i noticed is that PathMatchingResourcePatternResolver.findAllClassPathResources loads all resources from target, my compiled model is in target.classes.processes and classpath resource from resolver is target.classes so it seems it's not done recursively, but im having hard time to confirm this
You are correct to be looking at the deployment-resource-pattern property as the place to start. By default, it will include classpath*:**/*.bpmn so your file should be loaded.
That suggests the problem is either the value of deployment-resource-pattern has been changed or the contract-management jar is not on the classpath.
I suggest you try debugging the app to check the value of camunda.deployment-resource-pattern. Then have a look at the build process and make sure your application depends on contract-management, its the same version and the parent pom is building both of them.
I am working on a project that needs to be refactored in order to achieve decoupled modules.
I need to us an Adapter to decide which module to route to depending on some config.
+===========+
| Front-end |
+===========+
| |
+==================+ +==================+
| RESTful Service1 | | RESTful Service2 |
+==================+ +==================+
| |
+=========================+ +=========+
| Adapter | --- | Config |
+=========================+ +=========+
| | |
+=========+ +=========+ +=========+
| Module1 | | Module2 | | Module3 |
+=========+ +=========+ +=========+
I have a Java application, and want to package the modules in JARS using Maven.
RESTful Service1 will either talk to Module1 or Module2 while RESTful Service2 will always talk to Module3. I need to establish which is the nest way to package these modules.
RESTful Service1 will be in it's own Jar while Module1 and Module2 will have their own Jars too.
Question
Seeing that RESTful Service2 will always talk toModule3 only, should they be in the same Jar? Or should I separate them into two seperate Jars too?
Thanks
Because RS2 when deployed always needs to work with M3, putting them in the same jar offers one benefit: we won’t forget M3 when deploying RS2. But the downside is that it is difficult to reuse and deploy M3 to another system which does not require RS2.
I think the benefit above is little. Often, when deploying a system you should have a document or checklist. Even if some component was forgotten, chance is that you could detect and fix it quickly.
So the better option is to seperate RS2 and M3 into two jars.
I have multiple independent projects ( Java - Maven ) in this SVN repo :
|-- exemple.com/svn/java/apps/
|
| |-- Application_1
| | |-- branches
| | |-- tag
| | |-- trunk
|
| |-- Application_2
| | |-- branches
| | |-- tag
| | |-- trunk
Can I create a generic Jenkins maven build job with this SVN repository URL exemple.com/svn/java/apps/ and put as parameter the project name and branche name ?
Something like this ${Project_Name} and ${Branch_name}
You can, but that would mix up the job histories, someone trying to check it would be confused by the alternating histories.
It's more work, but it would probably be better, in my opinion, if you use a Jenkins Pipeline or the Jenkins Job DSL (a job generator).