I'm checking into buildpacks to create container images without Dockerfiles. Spring Boot’s build plugin uses a BuildPack builder image which will automatically detect that it's a spring boot application and builds the relevant image for us.
Now my question is, When i am running below maven command
mvn -f $GITHUB_WORKSPACE/pom.xml -pl service spring-boot:build-image -B -e -Dspring-boot.build-image.imageName="${{steps.acr_repo_server.outputs.acr_server}}/${{steps.acr_repo_server.outputs.acr_repository_name}}/${{inputs.microservice_name}}:${{ inputs.build_version }}" -Dmaven.test.skip=true -Dmaven.repo.local=${{ github.workspace }}/.m2/repository
I can see it internally uses below 6 buildpack for the application.
[INFO] [creator] 6 of 24 buildpacks participating
[INFO] [creator] paketo-buildpacks/ca-certificates 3.2.4
[INFO] [creator] paketo-buildpacks/bellsoft-liberica 9.3.7
[INFO] [creator] paketo-buildpacks/syft 1.12.0
[INFO] [creator] paketo-buildpacks/executable-jar 6.2.4
[INFO] [creator] paketo-buildpacks/dist-zip 5.2.4
[INFO] [creator] paketo-buildpacks/spring-boot 5.12.0
How can i add or ask maven to add this buildpack paketo-buildpacks/opentelemetry as well ? Is there any way to customise it or manually pass open telemetry build pack as an argument.
You can add Opentelemetry to the end of the existing buildpack list. See the example in the docs here.
pack build samples/java -b urn:cnb:builder:paketo-buildpacks/java -b paketo-buildpacks/opentelemetry -e BP_OPENTELEMETRY_ENABLED=true
With Spring Boot see the Maven and Gradle examples.
<project>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<image>
<buildpacks>
<buildpack>urn:cnb:builder:paketo-buildpacks/java</buildpack>
<buildpack>gcr.io/paketo-buildpacks/opentelemetry</buildpack>
</buildpacks>
<env>
<BP_OPENTELEMETRY_ENABLED>true</BP_OPENTELEMETRY_ENABLED>
</env>
</image>
</configuration>
</plugin>
</plugins>
</build>
</project>
Related
When I was building a CI/CD with github actions, I ran into the following problems.
[INFO] ------------------------------------------------------------
[INFO] Publication status: error
[INFO] ------------------------------------------------------------
[INFO] Steps:
[INFO] - Description: Publishing asset
[INFO] - Status: error
[INFO] - Errors: [The asset is invalid, Error while trying to set type: app. Expected type is: rest-api.]
[INFO] .........................................
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
The following is my maven configuration
<plugin>
<groupId>org.mule.tools.maven</groupId>
<artifactId>mule-maven-plugin</artifactId>
<version>${mule.maven.plugin.version}</version>
<extensions>true</extensions>
<configuration>
<sharedLibraries>
<sharedLibrary>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
</sharedLibrary>
</sharedLibraries>
<cloudhub2Deployment>
<uri>https://anypoint.mulesoft.com</uri>
<provider>MC</provider>
<environment>DEV</environment>
<target>****</target>
<muleVersion>4.4.0</muleVersion>
<server>anypoint-exchange-v3</server>
<businessGroup>AAAA</businessGroup>
<businessGroupId>*********</businessGroupId>
<applicationName>test-app2023</applicationName>
<replicas>1</replicas>
<vCores>0.1</vCores>
<deploymentSettings>
<http>
<inbound>
<publicUrl>tes-app2023t.anypoint.com</publicUrl>
</inbound>
</http>
<lastMileSecurity>false</lastMileSecurity>
<forwardSslSession>false</forwardSslSession>
<generateDefaultPublicUrl>true</generateDefaultPublicUrl>
</deploymentSettings>
<server>****</server>
<properties>
<anypoint.platform.base_uri>https://anypoint.mulesoft.com/</anypoint.platform.base_uri>
<anypoint.platform.client_id>****</anypoint.platform.client_id>
<anypoint.platform.client_secret>****</anypoint.platform.client_secret>
<anypoint.platform.analytics_base_uri>https://analytics-ingest.anypoint.mulesoft.com</anypoint.platform.analytics_base_uri>
</properties>
</cloudhub2Deployment>
<classifier>mule-application</classifier>
</configuration>
</plugin>
How should I properly set my exchange asset to rest-api instead of app?
I checked mulesoft's documentation and couldn't find a way to define...
The Mule Maven Plugin shared is configured for a Mule application. The asset type is set by the <classifier> element. Since this is a Mule application it is a correct type. In Anypoint Exchange a rest-api asset type identify an API description composed of RAML or OAS files. The Mule Maven Plugin is not compatible with that kind of assets, which makes sense because they are not built with Maven. If the Mule application implements a REST API, it is still a Mule application asset.
On the other hand if your asset is really RAML or OAS files you should use the Anypoint CLI instead to publish it to Anypoint Exchange. Read https://docs.mulesoft.com/exchange/to-create-an-asset for the different ways to create different types of assets.
I solved this problem myself.
The problem was caused by the duplication of the asset name of the API (raml) published from Design center and the asset name of the API (app) published from Maven.
I changed the artifactId in the pom.xml and solved the problem.
<groupId>****</groupId>
<artifactId>{asset name}</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>mule-application</packaging>
Whenever I run the maven build on my POM.xml, the build just hangs and the laptop becomes unresponsive. The last lines I always see are:
[INFO] --- filevault-package-maven-plugin:1.0.3:check-signature (default-check-signature) # my-project.ui.apps ---
[INFO] No signature defined. Skipping signature check.
[INFO]
[INFO] --- filevault-package-maven-plugin:1.0.3:analyze-classes (default-analyze-classes) # my-project.ui.apps ---
[INFO] Analyzing java package dependencies.
The plugin configuration in my POM file is below:
<plugin>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>filevault-package-maven-plugin</artifactId>
<version>1.0.3</version>
<configuration>
<filterSource>src/main/content/META-INF/vault/filter.xml</filterSource>
<failOnDependencyErrors>false</failOnDependencyErrors>
</configuration>
</plugin>
I am trying to build this using archetype 22. The same code and dependencies worked fine in archetype 13 project earlier.
I am relatively new to vaadin and started out with a spring boot application and the vaadin spring boot plugin. Everything worked fine until I got to the point where I tried to create my own components/widgets.
Unfortunately I didn't find any "official" example/documentation how to set up custom components within a spring boot application so I had to search the web to find out how to set up additional plugin(s) in maven to compile the code for the client side widgets. As far as I can tell from the log output the compilation of these components work, but when I try to access these components on the webpage I get an error:
Widgetset 'com.vaadin.DefaultWidgetSet' does not contain implementation for net.gtidev.test.components.MyComponent. Check its component connector's #Connect mapping, widgetsets GWT module description file and re-compile your widgetset. [...]
Here is the widget compiler log:
[INFO] Using com.vaadin:vaadin-client-compiler version 7.6.4
[ERROR] Mar 22, 2016 10:22:43 AM java.util.prefs.WindowsPreferences <init>
[ERROR] WARNUNG: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5.
[INFO] Compiling module net.gtidev.test.components.TestWidgetset
[INFO] Computing all possible rebind results for 'com.vaadin.client.metadata.ConnectorBundleLoader'
[INFO] Rebinding com.vaadin.client.metadata.ConnectorBundleLoader
[INFO] Invoking generator com.vaadin.server.widgetsetutils.ConnectorBundleLoaderFactory
[INFO] Populating eager bundle
. . . . . 250 more lines
[INFO] Computing all possible rebind results for 'com.vaadin.client.ui.dd.VAcceptCriterionFactory'
[INFO] Rebinding com.vaadin.client.ui.dd.VAcceptCriterionFactory
[INFO] Invoking generator com.vaadin.server.widgetsetutils.AcceptCriteriaFactoryGenerator
[INFO] Detecting available criteria ...
[INFO] creating mapping for com.vaadin.event.dd.acceptcriteria.AcceptAll
[INFO] creating mapping for com.vaadin.event.dd.acceptcriteria.And
[INFO] creating mapping for com.vaadin.event.dd.acceptcriteria.ContainsDataFlavor
[INFO] creating mapping for com.vaadin.event.dd.acceptcriteria.SourceIs
[INFO] creating mapping for com.vaadin.ui.AbstractSelect.TargetItemIs
[INFO] creating mapping for com.vaadin.ui.AbstractSelect.AcceptItem
[INFO] creating mapping for com.vaadin.ui.Table.TableDropCriterion
[INFO] creating mapping for com.vaadin.ui.Tree.TreeDropCriterion
[INFO] creating mapping for com.vaadin.event.dd.acceptcriteria.Not
[INFO] creating mapping for com.vaadin.event.dd.acceptcriteria.Or
[INFO] creating mapping for com.vaadin.event.dd.acceptcriteria.ServerSideCriterion
[INFO] creating mapping for com.vaadin.event.dd.acceptcriteria.SourceIsTarget
[INFO] creating mapping for com.vaadin.event.dd.acceptcriteria.TargetDetailIs
[INFO] creating mapping for com.vaadin.ui.Tree.TargetInSubtree
[INFO] Done. (0seconds)
[INFO] Compiling 1 permutation
[INFO] Compiling permutation 0...
[INFO] Compile of permutations succeeded
[INFO] Compilation succeeded -- 59,217s
[INFO] Linking into C:\projects\misc\vaadin-boot\target\vaadin-boot-0.0.1-SNAPSHOT\net.gtidev.test.components.TestWidgetset
[INFO] Link succeeded
[INFO] Linking succeeded -- 0,492s
The files I use for my custom component were generated by the eclipse vaadin addon within a vaadin 7 project which I created only for this purpose. When I started this vaadin 7 project in eclipse the component worked. I then copied these files into my spring boot maven project where the custom component does not get loaded any more.
I know that spring boot applications have a slightly different bootstrap mechanism and layout than "classic" webapps and that amongst other things static resources are not loaded from the webapp-folder but from the classpath:/static folder. I think that the core of the problem has something to do with this fact but I don't know what to do to fix it.
My Plugin configuration (I tried with and without the commented options):
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>7.6.4</version>
<configuration>
<strict>true</strict>
<force>true</force>
<!-- Enable during development to speed compiling. -->
<!-- <draftCompile>true</draftCompile>
<style>DETAILED</style> -->
<!-- End development options -->
<!--<webappDirectory>src/main/webapp/VAADIN/widgetsets</webappDirectory>-->
<modules>
<module>net.gtidev.test.components.TestWidgetset</module>
</modules>
</configuration>
<executions>
<execution>
<goals>
<goal>resources</goal>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
I tried different maven plugin combinations and configurations. In one example, there was also a Google-GWT Plugin mentioned, but running this plugin on the code produced the same log output as the vaadin plugin:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.5.1</version>
<!--<configuration>-->
<!--<webappDirectory>src/main/webapp/VAADIN/widgetsets</webappDirectory>-->
<!--<extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs>-->
<!--<runTarget>clean</runTarget>-->
<!--<hostedWebapp>${project.build.directory}/${project.build.finalName}</hostedWebapp>-->
<!--<noServer>true</noServer>-->
<!--<port>8080</port>-->
<!--<soycDetailed>false</soycDetailed>-->
<!--</configuration>-->
<executions>
<execution>
<goals>
<goal>resources</goal>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
To use custom client side extensions, Vaadin Add-ons, you'll need to add vaadin-maven-plugin to your project. It will scan the add-ons you use and GWT compile a new widgetset for your project that contains those extensions.
If you created the project with start.spring.io the maven plugin is not in your project by default. Create an example project for example using this Vaadin+Spring archetype or the official servlet based archetype and copy the vaadin-maven-plugin related parts from the pom.xml to your projects pom.xml. Then do a full build and everything should works as expected.
I have a multi-module project that has nexus-staging-maven-plugin configured in parent pom.xml:
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.6</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<!--<autoReleaseAfterClose>true</autoReleaseAfterClose>-->
</configuration>
</plugin>
By default it should be inherited by all submodules (except those disabled using technique in How to disable nexus-staging-maven-plugin in sub-modules)
However, when I start deployment:
mvn clean deploy -DskipTests=true -Prelease-sign-artifacts -Dgpg.passphrase=*****
I see the following message:
[INFO] Installing Nexus Staging features:
[INFO] ... total of 5 executions of maven-deploy-plugin replaced with nexus-staging-maven-plugin
...
[INFO] --- nexus-staging-maven-plugin:1.6.6:deploy (injected-nexus-deploy) # spookystuff-core ---
[INFO] Performing deferred deploys (gathering into "/home/peng/git/spookystuff/target/nexus-staging/deferred")...
[INFO] Installing /home/peng/git/spookystuff/core/target/spookystuff-core-0.3.2-SNAPSHOT.jar to /home/peng/git/spookystuff/target/nexus-staging/deferred/com/tribbloids/spookystuff/spookystuff-core/0.3.2-SNAPSHOT/spookystuff-core-0.3.2-SNAPSHOT.jar
...
[INFO] Reactor Summary:
...
[INFO] BUILD SUCCESS
No upload happens whatsoever. The artifact that should be uploaded to nexus were still cached under:
/target/nexus-staging/deferred
but neither the log nor nexus server record indicates that it has been uploaded. What has been wrong here and what should I do to fix it?
Trying to build our java app using sonar for analysis. We are behind a firewall so no access to maven repo1. We do have a internal corp Artifactory for third party artifacts and a project Artifactory for our local stuff. I am the SCM guy in charge of our build server, not a developer. That said the application with junit tests builds fine. We have two goals clean install. The sonar server is 3.5.1 and the port set to 8080 instead of 9000 This is in our pom.
<profile>
<id>sonarJsEnabled</id>
<properties>
<srcDir>src/main/static</srcDir>
<sonar.exclusions>libs/**/*,DSTCore/**/*,test/**/*</sonar.exclusions>
<maven.test.skip>true</maven.test.skip>
<sonar.language>js</sonar.language>
<sonar.branch>js</sonar.branch>
</properties>
</profile>
<profile>
<id>sonarHtmlEnabled</id>
<properties>
<srcDir>src/main/static</srcDir>
<sonar.language>web</sonar.language>
<sonar.branch>web</sonar.branch>
<sonar.web.fileExtensions>html,xhtml,jspf,jsp</sonar.web.fileExtensions>
<maven.test.skip>true</maven.test.skip>
</properties>
</profile>
<profile>
<id>sonar</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<!-- SERVER ON A REMOTE HOST -->
<sonar.host.url>http://10.226.xx.xx:8080</sonar.host.url>
</properties>
</profile>
and this:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>1.0-beta-2</version>
</plugin>
We add sonar:sonar When we build manually or with Bamboo we get this output.
C:\sonartest>mvn sonar:sonar
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'sonar'.
[INFO] org.apache.maven.plugins: checking for updates from EnterpriseArchitectureRepo
[INFO] org.codehaus.mojo: checking for updates from EnterpriseArchitectureRepo
[INFO] artifact org.codehaus.mojo:sonar-maven-plugin: checking for updates from EnterpriseArchitectureRepo
[INFO] Ignoring available plugin update: 2.0 as it requires Maven version 3.0
[INFO] Ignoring available plugin update: 2.0-beta-2 as it requires Maven version 3.0
[INFO] Ignoring available plugin update: 2.0-beta-1 as it requires Maven version 3.0
[INFO] ------------------------------------------------------------------------
[INFO] Building fundTrader
[INFO] task-segment: [sonar:sonar] (aggregator-style)
[INFO] ------------------------------------------------------------------------
[INFO] [sonar:sonar {execution: default-cli}]
[INFO] Sonar host: http://10.226.xx.xx:8080
[INFO] Sonar version: 3.5.1
[INFO] Execute: org.codehaus.sonar:sonar-maven-plugin:3.5.1:sonar
Downloading: http://repository.corp.net:8080/artifactory/libs-release/org/codehaus/sonar/sonar/3.5.1/sonar-3.5.1.pom
[INFO] Unable to find resource 'org.codehaus.sonar:sonar:pom:3.5.1' in repository EnterpriseArchitectureRepo (http://repository.corp.net:8080/artifactory/libs-release)
...
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Can not execute Sonar
Embedded error: Unable to build project for plugin 'org.codehaus.sonar:sonar-maven-plugin': Cannot find parent: org.codehaus.sonar:sonar for project: null:sonar-maven-plugin:maven-plugin:null for project null:sonar-maven-plugin:maven-plugin:null
Unable to download the artifact from any repository
Any help would be greatly apreciated.
I looks like the sonar-3.5.1.pom is not found. Consider adding Bintray's jcenter remote repository to your Artifactory (it has much more artifacts than Maven Center).
The simplest way to do it is to import the jcenter configuration from an Artifactory instance at repo.jfrog.org.
Just click on the Import -> Load and select jcenter from the list of loaded repository configurations.