siom79 / japicmp

Comparison of two versions of a jar archive
https://siom79.github.io/japicmp
Apache License 2.0
712 stars 107 forks source link

Feature Request: to be able to provide the exclusion list for the Maven plugin from an external file #212

Closed rohanb1985 closed 6 years ago

rohanb1985 commented 6 years ago

Hello, Please advise if it will be good feature to have the Exclusion list read from an external file. This will help to supply the list from outside the pom. Like when using Jenkins to build the pom, we can pass the file details from the Jenkins build parameters.

Thanks!

siom79 commented 6 years ago

Do you only need the exclusion list or further configuration items to be read from an external file?

PS: Why do you generate the pom by Jenkins but this generation cannot create the exclusion list?

rohanb1985 notifications@github.com schrieb am Mo., 16. Juli 2018, 14:14:

Hello, Please advise if it will be good feature to have the Exclusion list read from an external file. This will help to supply the list from outside the pom. Like when using Jenkins to build the pom, we can pass the file details from the Jenkins build parameters.

Thanks!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/siom79/japicmp/issues/212, or mute the thread https://github.com/notifications/unsubscribe-auth/ADlPtKxEb_bxxHZmpV0-C-kia5pfVFh5ks5uHIOngaJpZM4VRBS2 .

rohanb1985 commented 6 years ago

Hello, I was trying to include this tool into our CI pipeline, and fail the build whenever there is a compatibility break. In case the break is accepted, the developer is supposed to update the file/method/field/... into the exclusion list, and re-trigger the build.

Modifying the POM for each time is not a good idea. So, my request was to keep the most frequently modified attributes outside of the pom, in a separate file. This way the POM will remain constant.

I tried the following way to pass the exclusion list from outside: mvn verify '-Dexcludes=com.rohan.digital.impl.common.DigitalAppListener,com.rohan.digital.impl.services.GetCustomerDetailsService#customerID'

However, the above fails whenever the list contains some methods with comma separated parameters, like below - mvn verify '-Dexcludes=com.rohan.digital.impl.common.DigitalAppListener,com.rohan.digital.impl.services.GetCustomerDetailsService#getCustomerDetails(String,String)'

In the above case, the list is split based on the comma (as per maven default behavior), and the list becomes incorrect and throws an exception.

Hence the request to pass these details from outside.

thanks.

twogee commented 6 years ago

Or .split(",(?![^()]*\\))")

rohanb1985 commented 6 years ago

@twogee - can you please elaborate a bit more? If you are referring to splitting of the list, it is the Maven's default behavior to split directly based on comma and store in a List. Can we modify this behavior? If yes, can you please advise me how? Thanks!

twogee commented 6 years ago

Sorry about a half-baked response. What makes you believe that Maven splits the property on comma? Could you please provide some logs?

rohanb1985 commented 6 years ago

@twogee - thanks and no issues! Please find attached my pom here: pom_JAPICMP.xml.txt

I have compatibility breaks in the following methods, but I wanted to exclude them.

Hence I tried the following:

mvn initialize -nsu -f pom_BWC_Check.xml -Dlast.released.version=1.0.13.10 -Ddrop.version=drop2 -Dexclusion.list=com.rohan.digital.impl.services.GetCustomerService#getSomeCustomer(com.rohan.digital.resources.models.V1Customer,com.rohan.services.lib.Contact),com.rohan.digital.impl.services.GetCustomerService#prepareInput(java.util.Set)

But it failed with error:

[ERROR] Failed to execute goal com.github.siom79.japicmp:japicmp-maven-plugin:0.12.0:cmp (japicmp-drop2) on project digital-impl-ces: Execution japicmp-drop2 of goal com.github.siom79.japicmp:japicmp-maven-plugin:0.12.0:cmp failed: Wrong syntax for exclude option 'com.rohan.digital.impl.services.GetCustomerService#getSomeCustomer(com.rohan.digital.resources.models.V1Customer': Filter option 'com.rohan.digital.impl.services.GetCustomerService#getSomeCustomer(com.rohan.digital.resources.models.V1Customer' should contain one opening ')'. -> [Help 1]

On debugging the build, I found the parameters were split on comma and passed as list to the plugin. During the split, the first method name became incorrect. I didn't find any code in the plugin where this split was done, and on further google-ing I came to conclusion that the split was done by Maven.

twogee commented 6 years ago

Thanks, your description makes things clearer. Unless I'm mistaken, each exclude is split on semicolon, so maybe it's worth trying

<excludes><exclude>${exclusion.list}</exclude></excludes>

in the POM, where exclusion.list should be semicolon-separated.

rohanb1985 commented 6 years ago

Thanks a lot!! This perfectly solves my requirement! I will mark this issue as closed. Thanks again for your help!