Spring cloud data flow custom application properties - spring-cloud-dataflow

I created a custom spring cloud data flow application.
I would like to create a stream with it and put some application properties in it, as we can add for the provided application log (0/3 properties):
I tried with application.yml file in resources folder:
spring:
application:
toto: 'titi'
but it didn't work.
I also tried to create some Properties.class
public class Properties {
//public static final String PREFIX = "portin";
private String toto;
public Properties(String toto) {
this.toto = toto;
}
public Properties() {
}
public String getToto() {
return toto;
}
public void setToto(String toto) {
this.toto = toto;
}
}
and add the folowing declaration in dataflow-configuration-metadata-whitelist.properties file:
configuration-properties.classes=com.mycompany.Properties
but that was not a success and the aplication doesn't have any property.
I couldn't find anything relevant in documentation (I am not English speaking native so I may have misread something).
Thanks for helping
EDIT after moving dataflow-configuration-metadata-whitelist.properties in META-INF folder
the whitelist property files were not under META-INF folder.
Now I have this project:
but it doesn't help. The pom.xml is:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>docker-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-app-starter-metadata-maven-plugin</artifactId>
<executions>
<execution>
<id>aggregate-metadata</id>
<phase>compile</phase>
<goals>
<goal>aggregate-metadata</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
then I build the application with docker. Is there something docker specific to do then?
I could read the documentation but cannot see what is missing on my project

For the custom application properties, you can make sure if you follow Spring Boot configuration properties configuration correctly. You can see some of the examples from the out of the box apps here
I am not sure which version of SCDF do you use. If you are on the release before SCDF 2.x, then the name of the whitelist properties needs to be spring-configuration-metadata-whitelist.properties as the whitelist properties file with the name dataflow-configuration-metadata-whitelist.properties is supported only from SCDF 2.x.
Also, make sure to place the whitelist properties file into /META-INF directory under classpath (src/main/resources directory) for example here.
Regarding the documentation, please follow the instructions mentioned here in the SCDF documentation.

I could do the job thanks to this post: Spring Cloud Dataflow Kubernetes get properties of jar from dockerfile
The way I registered the app was wrong.
Now, I add the companion metadata URI and it works

Related

Strange issue with TomEE 8.0.4 and OpenApi extension (Swagger-UI 1.0.3)

I'm using TomEE microprofile and have defined my rest application path this way:
#ApplicationPath("api")
public class RestConfiguration extends Application {
}
When the application is deployed, tomee log shows the access url to the generated front end resources:
Service URI: http://localhost:8080/api/openapi-ui/
When accesing the url got this message in the swagger-ui web page:
Fetch error undefined /openapi
If I change the application path to empty:
#ApplicationPath("")
Then all works fine and swagger shows all of the service method definitions.
So, what should I do to make it work adding "api" to the ApplicationPath annotation?
Tried with "/api", but doesn't work either.
I made the test here with Tomee-8.0.4, follow the configurations, assumed that you that is using a JAR.
in your pom.xml use the dependency:
<dependency>
<groupId>org.microprofile-ext.openapi-ext</groupId>
<artifactId>openapi-ui</artifactId>
<version>1.1.3</version>
</dependency>
<build>
<finalName>tomee-demo</finalName>
<plugins>
<plugin>
<groupId>org.apache.tomee.maven</groupId>
<artifactId>tomee-maven-plugin</artifactId>
<version>${tomee.version}</version>
<executions>
<execution>
<id>executable-jar</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<context>ROOT</context>
<tomeeClassifier>microprofile</tomeeClassifier>
</configuration>
</plugin>
</plugins>
</build>
in microprofile-config.properties use:
mp.openapi.servers=http://localhost:8080/api
openapi.ui.yamlUrl=/api/openapi
openapi.ui.serverVisibility=visible
and run your project again.
test performed
reference:
https://github.com/microprofile-extensions/openapi-ext/tree/master/openapi-ui

Maven changes plugin not working with Jira cloud

I'm trying to use maven changes plugin with jira cloud but in vain.
My pom looks like this :
.....
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-changes-plugin</artifactId>
<version>2.11</version>
...
</executions>
<configuration>
<useJql>true</useJql>
<jiraUser>xxxx#gmail.com</jiraUser>
<jiraPassword>******</jiraPassword>
<webUser>xxxxx#gmail.com</webUser>
<webPassword>******</webPassword>
<onlyCurrentVersion>true</onlyCurrentVersion>
<smtpHost>smtp.gmail.com</smtpHost>
<smtpPort implementation="java.lang.Integer">465</smtpPort>
<username>xxxx#gmail.com</username>
<password>*****</password>
<toAddresses>
<toAddress implementation="java.lang.String">xxxxxx#yahoo.fr</toAddress>
</toAddresses>
<mailSender>
<name>Release Notification</name>
<email>xxxx#gmail.com</email>
</mailSender>
<issueManagementSystems>
<issueManagementSystem>JIRA</issueManagementSystem>
</issueManagementSystems>
</configuration>
</plugin>
</plugins>
</build>
<issueManagement>
<system>JIRA</system>
<url>https://xxxxx.atlassian.net/browse/PROJ</url>
</issueManagement>
....
I'm getting a 403 error.
I think that when using jira cloud, I should use a token but I don't know how to configure the plugin with it.
Any help please ?
I was looking for how to configure to token in the plugin declaration. Actually all I should to do is using the field webPassword to set that token :
<webUser>user_email/webUser>
<webPassword>jira_token</webPassword>
and delete fields jiraUser and jiraPassword.

How to generate OAS yaml file from sources annotations using swagger 3.x?

I've spend hours on searching how to generate the OAS spec yaml file using swagger codegen in Java and I give up. I'd like to provide all API spec data within the Java source as a code annotations. It would be great to expose it via maven.
AFAIK I should use swagger-codegen-maven-plugin, but I wasn't able to make it scan the source code to generate OAS yaml or JSON file.
I would appreciate a snippet of pom.xml with valid codegen plugin config.
Perhaps I should get back to the previous Swagger as this use case was handled straight forward in 2.x. Now i get frustrated of 3.x approach.
Swagger Codegen generates code from an OpenAPI file. To do the opposite – generate an OpenAPI file from Java code annotations – you need Swagger Core e.g. its Maven plugin, swagger-maven-plugin.
Add following dependencies to your pom.xml:
<dependencies>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-jaxrs2</artifactId>
<version>2.0.9</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
</dependencies>
Then utilise it in your build; example config:
<plugins>
<plugin>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-maven-plugin</artifactId>
<version>2.0.9</version>
<configuration>
<outputFileName>openapi</outputFileName>
<outputPath>${project.build.directory}/generatedtest</outputPath>
<configurationFilePath>${project.basedir}/src/main/resources/configurationFile.yaml</configurationFilePath>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>resolve</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>

Failed to read artifact descriptor for org.apache.maven.plugins:maven-source-plugin:jar:2.4

Thanks to a Dropwizard Maven archetype I generated a sample Dropwizard Maven project. The pom.xml notably uses maven-source-plugin:
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
When I run "clean install" I have the following error :
Plugin org.apache.maven.plugins:maven-source-plugin:2.4 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-source-plugin:jar:2.4: Could not transfer artifact org.apache.maven.plugins:maven-source-plugin:pom:2.4 from/to central (http://repo.maven.apache.org/maven2): Connection refused: connect -> [Help 1]
The "maven-source-plugin" dependency is stored in the Nexus repository of my company. So I tried the adding of the plugin dependency between dependencies and /dependencies :
<dependencies>
...
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.4</version>
</dependency>
</dependencies>
but it did not correct the problem. I also tried to add the dependency at the call of the plugin :
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.4</version>
</dependency>
</dependencies>
</plugin>
but it did not work either
Two possible situations :
Your company uses a proxy to connect to the public Maven repository. Then ask someone in your company what the IP address of the proxy is then put it in your settings.xml file
Your company has its/their own Maven repository/ies (Nexus repository for example). Then ask someone in your company what the Nexus repository is then put it in your pom.xml or in your settings.xml. See Adding maven nexus repo to my pom.xml and https://maven.apache.org/guides/mini/guide-multiple-repositories.html
It may happen, e.g. after an interrupted download, that Maven cached a broken version of the referenced package in your local repository.
Solution: Manually delete the folder of this plugin from cache (i.e. your local repository), and repeat maven install.
How to find the right folder? Folders in Maven repository follow the structure:
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.4</version>
</dependency>
is cached in ${USER_HOME}\.m2\repository\org\apache\maven\plugins\maven-source-plugin\2.4
Update the apache-maven-3.5.0-bin\apache-maven-3.5.0\conf\settings.xml file.
Check your internet explorer proxy --> Setting --> Internet explorer -->Connection --> LAN Setting
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<username>user</username>
<password>****</password>
<host>proxy</host>
<port>8080</port>
</proxy>
I am using JDK 7 for maven project and I used -Dhttps.protocols=TLSv1.2 as argument in JRE. It has allowed to download all maven repository which were failing earlier.
org.apache.maven.plugins:maven-source-plugin does not exist in the repository http://repo.maven.apache.org/maven2.
You have to download it from Maven central where it exists => maven-source-plugin
Verify your pom definition or your settings.xml file.
so I am assuming that this project you are doing in your private eclipse (not company provided eclipse where you work). The same problem I resolved just as below
quick fix : got to .m2 file --> create a backup of settings.xml --> remove settings.xml --> restart your eclipse.
On my side it was coming from an error in my settings.xml file.
I had a bad tag. Just removed it, refreshed and i was good to go.
Remove the content of the folder \.m2\repository\org\apache\maven\plugins\maven-resource-plugin\2.7. The cached info turned out to be the issue.
I use intelliJ and finally I created my own settings.xml and added the following content structure to it. In my project's pom.xml, the nexus repositories were defined but for some reason it was always hitting the external apache maven repo which is blocked in my company.
<settings>
<mirrors>
<id>nexus</id>
<url>nexusURL </url>
<mirrorOf>central</mirrorOf>
<mirror>
<profiles>
<profile>
<repositories>
<repository>
</settings>

Maven Parent Pom with custom site.xml and images

I'm currently struggling with the maven site plugin. I have a corporporate/ super pom (packaging type pom) which defines all dependency version and also configures the site plugin. In addition I placed some image resources under /src/site/resources/images which are referenced in a custom site.xml (for example ./images/logo.jpg).
Another module references this parent pom and when I call mvn site it seems that the site.xml is getting picked up. But unfortunately the links to the images do not work. When I had a look in the target/site folder the images were missing. I also tried to create an additional 'corporate' resource module where I put the site resources (also under /src/site/resources), and reference this module as a dependency in the maven-site-plugin like this:
<build><plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>${maven-site-plugin.version}</version>
<dependencies>
<dependency>
<groupId>de.il</groupId>
<artifactId>build-tools</artifactId>
<version>${build-tools.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>attach-descriptor</id>
<goals>
<goal>attach-descriptor</goal>
</goals>
</execution>
</executions>
<configuration>
<reportPlugins>
<plugin>
....
But this does not seem to work either. It worked for other reporting modules like pmd with special configurations which were placed under /src/main/resources though...the site resources does not seemed to be picked up and published to the repository.
So the question is: How is it possible to attach images and stylesheets to a maven super pom? I'm using Maven 3 btw...

Resources