Liquibase customPrecondition causes maven plugin to fail - maven

We have our liquibase scripts setup in a maven project and we are using the liquibase maven plugin to execute the scripts on deploy of our software.
We need to ensure that only the liquibase scripts relevant to the version of the software being deployed are run.
I have created a custom PreCondition in liquibase for each changeset as follows:
<preConditions onFail="CONTINUE">
<customPrecondition className="class.CompatibleVersion">
<param name="version" value="1.0.0"/>
</customPrecondition>
</preConditions>
This preCondition throws a CustomPreconditionFailedException when the precondition version parameter is > deployedVersion.
The precondition is working unfortunately whenever it throws the CustomPreconditionFailedException instead of skipping the change set (onFail="CONTINUE") the maven plugin fails with the following:
Error setting up or running Liquibase: Migration failed for change set src/database/changelog/db.changelog-1.0.1.xml::1.0.1_script1::fred.smith:
[ERROR] Reason:
[ERROR] db.changelog-master.xml : liquibase.precondition.CustomPreconditionWrapper#2add4d24 : liquibase.exception.CustomPreconditionFailedException: Change set version : 1.0.1 incompatible with deploy version : 1.0.0. Skipping change set. Precondition Error
This is the exception I expect it to throw but I am expecting the change set to be skipped due to the onFail="CONTINUE".
What am I missing ?
Thanks.

Related

Make maven version plugin fail if it can't check for new versions

I'm using the maven version plugin to update specific properties:
mvn versions:update-properties "-Dincludes=com.foo:my-dep:*:*:*" "-DgenerateBackupPoms=false"
Anyway sometimes, due a network problem, the check fails with:
[main] WARNING org.apache.maven.artifact.repository.metadata.DefaultRepositoryMetadataManager - repository metadata for: 'artifact com.foo:my-dep' could not be retrieved from repository: central due to an error: Transfer failed for https://repo.maven.apache.org/maven2/com/foo/my-dep/maven-metadata.xml
Nevertheless only a warning is printed and the build goes on.
Would it be possible to halt everything in this case?

Weblogic Jacoco connection error wrong version

I am trying to retrieve coverage dump from weblogic server using maven project.
after running mvn I am getting:
Failed to execute goal org.jacoco:jacoco-maven-plugin:0.7.7.201606060606:report (jacoco-report) on project jacocotest: An error has occurred in JaCoCo report generation. Error while creating report: Cannot read execution data version 0x1006. This version of JaCoCo uses execution data version 0x1007. -> [Help 1]
and in weblogic log:
org.jacoco.agent.rt.internal_6da5971.core.data.IncompatibleExecDataVersionException: Cannot read execution data version 0x1006. This version of JaCoCo uses execution data version 0x1007.
at org.jacoco.agent.rt.internal_6da5971.core.data.ExecutionDataReader.readHeader(ExecutionDataReader.java:129)
at org.jacoco.agent.rt.internal_6da5971.core.data.ExecutionDataReader.readBlock(ExecutionDataReader.java:109)
at org.jacoco.agent.rt.internal_6da5971.core.runtime.RemoteControlReader.readBlock(RemoteControlReader.java:47)
at org.jacoco.agent.rt.internal_6da5971.core.data.ExecutionDataReader.read(ExecutionDataReader.java:92)
at org.jacoco.agent.rt.internal_6da5971.output.TcpConnection.run(TcpConnection.java:59)
at org.jacoco.agent.rt.internal_6da5971.output.TcpServerOutput$1.run(TcpServerOutput.java:63)
at java.lang.Thread.run(Thread.java:724)
in pom I have:
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.7.201606060606</version>
and agent jar,
META-INF\Manifest.mf
Implementation-Version: 0.7.7.201606060606
"0x1006" is the version of data that was produced by JaCoCo versions 0.5.0 - 0.7.4. So check carefully that you don't execute WebLogic Server with an old version of JaCoCo, i.e. what is used in -javaagent parameter for java for start of WebLogic Server.

Maven issue while Building for a latest fix given by WSO2

WSO2 has given a latest fix for Governance Registry5.3.0(Governance REST API Update issue). While building a code for applying a fix the below error is thrown.
Error when building code using Maven.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.1:compile (default-compile) on project org.wso2.carbon.governance.api: Compilation failure: Compilation failure:
[ERROR] \Users\a596500\Downloads\carbon-governance-master\components\governance\org.wso2.carbon.governance.api\src\main\java\org\wso2\carbon\governance\api\util\CheckpointTimeUtils.java:[22,30] error: package org.apache.commons.lang does not exist
[ERROR] Failed to execute goal on project org.wso2.carbon.governance.api: Could not resolve dependencies for projectorg.wso2.carbon.governance:org.wso2.carbon.governance.api:bundle:4.7.2-SNAPSHOT: The following artifacts could not beresolved: org.wso2.carbon.registry:org.wso2.carbon.registry.extensions:jar:4.6.1-SNAPSHOT, org.wso2.carbon.registry:org.wso2.carbon.registry.common:jar:4.6.1-SNAPSHOT, org.wso2.carbon.registry:org.wso2.carbon.registry.admin.api:jar:4.6.1-SNAPSHOT
org.wso2.carbon.registry:org.wso2.carbon.registry.indexing:jar:4.6.1-SNAPSHOT: Could not find artifact org.wso2.carbon.registry:org.wso2.carbon.registry.extensions:jar:4.6.1-SNAPSHOT in nexuspro-level0 (https://repo.fmr.com/content/groups/level0/)
Please clone below repos, Move to the relevant tag and run an mvn clean install -e on each and every repo accordingly.
https://github.com/wso2/carbon4-kernel.git tag : 4.4.7
https://github.com/wso2/carbon-registry.git tag : 4.6.0
https://github.com/wso2/carbon-governance.git tag : 4.7.1
https://github.com/wso2/carbon-governance-extensions.git tag : 4.5.2
https://github.com/wso2/jaggery-extensions.git tag : 1.5.5
https://github.com/wso2/carbon-store tag : 2.4.6
https://github.com/wso2/product-greg.git tag : 5.3.0
To apply the fix and generate the latest jar you have to apply the fix manually to 5.3.0 tag from your local machine and build the source.

Sonar 5.1.1 "Unable to create symbol table" error

I'm running a sonarqube server version 5.1.1, and when running maven analyzer with "mvn sonar:sonar" I get the following error:
[ERROR] [12:54:13.778] Unable to create symbol table for : /Users/rodrigouchoa/Java/git/spread/mj/wicket-exemplo/Build/Codigos_Fonte/wicket-exemplo-parent/wicket-exemplo-web/src/main/java/br/gov/mj/wicket/exemplo/web/service/SegurancaService.java
java.lang.IllegalStateException: Could not resolve type parameter: PK in class IGenericPersister
Is there a solution for this issue?
The java plugin for sonarqube was recently updated. Try to update it and check if the problem is fixed.

sonar credential issue while running jenkins build

I am using Jenkins version 1.480.3 and Sonar version 3.4.1. I am executing Sonar analysis on my project using maven build option "sonar:sonar -PsonarJs" and below properties in jenkins:-
sonar.login=sonar
sonar.password=*****
sonar.host.connectTimeoutMs=300000
sonar.host.readTimeoutMs=600000
projectVersion=${projectVersion}
sonar.projectKey=abc
sonar.projectName=abc
sonar.projectVersion=${projectVersion}
sonar.sources=${MyPath)
sonar.branch=javascript
sonar.language=js
sonar.forceAnalysis=true
"sonar" is a local user created in Sonar.Upon firing the build in jenkins,sometimes my build fails with the following error:-
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.0:sonar (default-cli) on project vos-generic: Can not execute Sonar: Not authorized. Please check the properties sonar.login and sonar.password.
This is an intermittent error, sometimes the build fails with this error and sometimes it is successful.
I tried to resolve this error by creating a new local user "sonar1" in Sonar and adding it to the administrative group but got the same error again.
Any help is appreciated.Thanks in advance.

Resources