How to create bamboo plugin with java11 - maven

I am creating bamboo plugin with java11 and maven project.
mvn clean install is returning success status with below NPE
java.lang.NullPointerException
at aQute.bnd.osgi.Processor.quote(Processor.java:1322)
at aQute.bnd.header.Attrs.append(Attrs.java:404)
at aQute.bnd.header.Parameters.append(Parameters.java:172).......
when tried uploading plugin in bamboo 6.8.1 with java11 then it throws failure error.
Firstly tried on hello world plugin as well as per pom.xml mentioned in URL:
https://community.atlassian.com/t5/Bamboo-questions/Create-bamboo-plugin-tutorial/qaq-p/686456
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<bamboo.version>6.2.3</bamboo.version>
<bamboo.data.version>6.2.3</bamboo.data.version>
<amps.version>6.2.3</amps.version>
<plugin.testrunner.version>1.2.3</plugin.testrunner.version>
<atlassian.spring.scanner.version>1.2.6</atlassian.spring.scanner.version>
<atlassian.plugin.key>${project.groupId}.${project.artifactId}
</atlassian.plugin.key>
</properties>
expecting bamboo plugin should get build without any error and should get upload successfully.

Bamboo doesn't work with Java 11 yet. So plugin should be built with Java 8 as well

Related

Failed to execute goal... error. Deploying to Heroku

I am trying to deploy my application to Heroku, but I'm geting this message all the time. When I run it in IntelliJ the application is working.
The application is written in Spring Boot.
What could be the cause of this error?
Here is my pom.xml
I think the problem is due to a mismatch of the Java version in your project's pom.xml file and that being used by Heroku.
A simple solution could be either specify your target version in pom.xml or configure the Java version in Heroku. You can add the following code below <description> in your pom.xml file to specify your target version.
<properties>
<java.version>1.8</java.version>
</properties>

Error:java: release version 5 not supported

I have a maven project in IntelliJ IDEA;
When I run the test using mvn test everything is fine, but when I use
the green arrow on IntelliJ IDEA I got this error: Error:java: release version 5 not supported
Go to: File->Project structure->Project and configure Project SDK to 1.8
It is a common error in IntelliJ.
Try adding
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
to your POM file.
Or:
update Java Compiler
update SDK version

mvn appengine:devserver [ERROR] Could not find goal 'devserver' in plugin com.google.cloud.tools:appengine-maven-plugin:1.3.1 among available goals

Yes, I went through similar question on 'Goal' not found Error. But havent been able to solve my problem -
Im deploying my SpringBoot App to GCP and following this.
Had a few hiccups so far, but managed to overcome.
This time, the problem is that I added the goal, but still I see the same error. Like this ->
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>1.3.1</version>
<configuration>
<project>${endpoints.project.id}</project>
<version>1</version>
<devserver.host>localhost</devserver.host>
<devserver.port>8888</devserver.port>
</configuration>
</plugin>
Also, I updated maven to latest version, did a 'mvn clean package' (which was successful build) and then did 'mvn appengine:devserver' and it says -
[ERROR] Could not find goal 'devserver' in plugin com.google.cloud.tools:appengine-maven-plugin:1.3.1 among available goals deploy, deployCron, deployDispatch, deployDos, deployIndex, deployQueue, genRepoInfoFile, help, run, stage, start, stop -> [Help 1]
[ERROR]
Any suggestions, warmly welcome!
Thanks.
There are two App Engine Maven plugins you can use to launch your SpringBoot app:
App Engine SDK-based and Cloud SDK-based.
The App Engine SDK-based plugin should have the following groupId entry in pom.xml:
<groupId>com.google.appengine</groupId>
and the command to run the App Engine development web server is
$ mvn appengine:devserver
The Cloud SDK-based plugin should have the following groupId entry in pom.xml:
<groupId>com.google.cloud.tools</groupId>
and the command to run the App Engine development web server is
$ mvn appengine:run
In that case you were using the wrong command for the chosen plugin.
Using $ mvn appengine:run with your code should work.
In my case, the gcloud App-Engine java component was missing, I had to install it by running:
gcloud components install app-engine-java
After that, the App-Engine maven plugin worked properly.

mvn command without anything throws build failure error

Okay, I am totally new to maven and just installed one.
I have configured JAVA_HOME so that when I type mvn -version, the message shows with
Apache Maven 3.3.9
Maven home: /user/share/maven
Java version: 1.8.0_131, ...
Java home: /usr/lib/jvm/java-8-openjdk-amd64/jre
And I just typed "mvn" out of curiosity, which throw an error back at me.
Now when I am trying to clean using mvn clean,
I get all the errors related to build failure.
Can someone tell me where to go next from here?
You need a pom.xml file in your current working directory. Put this into a new pom.xml and you'll see the error change to something more descriptive:
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>foo</groupId>
<artifactId>bar</artifactId>
<version>1</version>
</project>

Sonarqube is not showing code coverage after running

I'm running sonarqube with maven.
I have installed it using following way.
Using brew, I installed mysql and sonar.
When I run I get 7 critical bugs but the code coverage for 88 tests is zero
When I run it with IntelliJ's tools, I get the following results. (not zero!)
This is when I check Jacoco results directly. In $base_direc/target/jacoco/index.html
The same code when run with sonar-scanner
This is my maven configuration
My ~/.m2/settings.xml
Edit 1:
I have found this in logs.
Edit2:
I have edited ~/.m2/settings.xml
added
<properties>
<sonar.host.url>http://localhost:9000/</sonar.host.url>
</properties>
Edited /usr/local/Cellar/sonarqube/6.3.1/libexec/conf/sonar.properties
added sonar.host.url=http://localhost:9000/
Edited /usr/local/etc/sonar-scanner.properties added - sonar.host.url=http://localhost:9000/
Ran the application in all above ways and the results were same, i.e, I could see Jacoco results but not in sonar.
Is it possible that if bugs are found sonar refuses to do code coverage?!
I found the solution -
The maven plugin I have included has configuration of Jacoco's destfile and datafile as ${basedir}/target/coverage-reports/jacoco-unit.exec
but by default sonar reads at ${basedir}/target/jacoco.exec. I changed the default at http://localhost:9000/settings?category=java
Ref: Sonar Code Coverage
Couldn't find the working reference link. Here is aux link: Baeldung Sonar and jacoco
I've resolved this by using the following steps:
1.To begin, I've add configuration in our pom.xml.
<properties>
<sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>
<sonar.jacoco.reportPath>${project.basedir}/../target/jacoco.exec</sonar.jacoco.reportPath>
<sonar.language>java</sonar.language>
</properties>
2.In sonarqube properties file added the below part.
sonar.projectName=${JOB_NAME}
sonar.projectVersion=1.0.0
sonar.sources=src/main
sonar.sourceEncoding=UTF-8
sonar.language=java
sonar.tests=src/test
sonar.junit.reportsPath=target/surefire-reports
sonar.surefire.reportsPath=target/surefire-reports
sonar.jacoco.reportPath=target/jacoco.exec
sonar.binaries=target/classes
sonar.java.coveragePlugin=jacoco
sonar.verbose=true
I had same problem, I will help you to resolve that. Here 1st thing is to walk through your pom file.
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<jacoco.version>0.8.5</jacoco.version>
<sonar.jacoco.reportPath>target/jacoco-ut.exec</sonar.jacoco.reportPath>
<sonar.jacoco.itReportPaths>target/jacoco-it.exec</sonar.jacoco.itReportPaths>
</properties>
In pom file, you used jacoco-ut.exec you have to use below properties on your
execute SonarQube Scanner in Jenkins
sonar.java.binaries=target/classes
sonar.junit.reportsPath=target/surefire-reports
sonar.surefire.reportsPath=target/surefire-reports
sonar.jacoco.reportPath=target/jacoco-ut.exec
Keep in your mind about jacoco.exec in pom and property name of executing SonarQube Scanner in Jenkins
For me, the issue was:
Reports are getting generated at pre-package phase. Now we updated Pull Request maven phase.
mvn -B clean test to mvn -B clean package.
Also, latest SONAR prefers XML report. You can specify path in maven pom via:
<sonar.coverage.jacoco.xmlReportPaths>target/site/jacoco/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
and in sonar project properties file:
sonar.projectKey=my-project
sonar.projectName=my-project
sonar.language=java
sonar.java.binaries=target/classes
sonar.sources=src/main
sonar.tests=src/test
sonar.exclusions=**/beans/*,**/config/*,**/constants/*,**/dtos/**,**/entity/*,**/exceptions/*,**/insights/*,**/App.java
sonar.sourceEncoding=UTF-8
sonar.dynamicAnalysis=reuseReports
sonar.junit.reportsPath=target/surefire-reports
sonar.java.coveragePlugin=jacoco
sonar.coverage.jacoco.xmlReportPaths=target/site/jacoco/jacoco.xml

Resources