Generic jenkins job for multiple projects - java

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).

Related

Flyway scripts migration execution order while running test cases Junit

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.

Load process definitions from multiple modules in camunda

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.

Swagger-UI does not show my controllers from different modules?

I'm using swagger with Spring Boot and the UI does not shows the controllers.
My project looks like: I have a few gradle modules in root project.
There are two of them for REST:
documentation (in this module I have package *.documentation and there I have a few interfaces with swagger annotations)
rest (in this module I have package *.controller and there each controller implements documentation interface from module documentation)
When I'm trying to run swagger-ui there is no resources on the UI.
BUT! when I move my controllers into documentation module then everything works fine or when I move interfaces with swagger annotations to rest module. Problem is only when I use two modules, one for swagger annotations and one to implement those interfaces.
What should I do to make it works with two modules? I tried also ComponentScan annotation in my SwaggerConfig class(this class is also in documentation module) but it does not works too.
My project structure:
|-- Project
| |-- app
| |-- src/main/java
| |-- mypackage
| |-- App.java
| |-- documentation
| |-- src/main/java
| |-- mypackage
| |-- config
| |-- SwaggerConfig.java
| |-- documentation
| |-- ProductSwaggerInterface.java
| |-- rest
| |-- src/main/java
| |-- mypackage
| |-- controller
| |-- ProductController.java
In 'app' module I just run the SpringBoot app, in 'documentation' module I have interfaces with swagger annotations and in module 'rest' I implementing those interfaces in my controller.

Adapter Pattern and packaging

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.

Document a maven archetype with the project layout and usage

When I generate the site documentation using the site plugin, all I see in the About page is the description of the archetype that I've specified in the <description> element of the archetype's POM.
How do I get to see something like the generated project's layout and the archetype usage like this? Do I only have to do that manually?
The Maven Site plugin looks under src/site for documentation. By default it expects the documentation to be written using the Doxia Markup language. The project structure you reference is written using this markup. You can find it in the source code of src/site/apt/index.apt in the Maven archetypes project.
The markup for the project structure you mention is defined there:
34 +----+
35
36 project
37 |-- pom.xml
38 `-- src
39 `-- site
40 |-- apt
41 | |-- format.apt
42 | `-- index.apt
43 |-- fml
44 | `-- faq.fml
45 |-- fr
46 | |-- apt
47 | | |-- format.apt
48 | | `-- index.apt
49 | |-- fml
50 | | `-- faq.fml
51 | `-- xdoc
52 | `-- xdoc.xml
53 |-- xdoc
54 | `-- xdoc.xml
55 |-- site_fr.xml
56 `-- site.xml
57
58 +----+
It should be fairly obvious looking at that, how to write the markup for your own such structure. If you wish to auto-generate such a structure, then I suspect that you may need to write a simple Maven plugin to iterate through your project directories. I'm not aware of any preexisting plugins, but I wouldn't be surprised to find one out there.

Categories

Resources