Skip to content
This repository has been archived by the owner on Jan 13, 2023. It is now read-only.

codenarc 2.2.3 referenced but not available on Maven central #170

Closed
chrissike opened this issue Nov 7, 2022 · 10 comments
Closed

codenarc 2.2.3 referenced but not available on Maven central #170

chrissike opened this issue Nov 7, 2022 · 10 comments
Assignees
Labels
plugin:android Specific to the Android plugin

Comments

@chrissike
Copy link

Dear ecoCode maintainers,

I noticed that currently the pom.xml files in modules android-plugin and codenarc-converter are referencing codenarc 2.2.3 - however on Maven central the latest available 2.x version is 2.2.0

BR Christina

@dedece35
Copy link
Collaborator

dedece35 commented Nov 7, 2022

hello @jhertout and @olegoaer,
I don't know android part of ecoCode, but when I try with 2.2.0 (indeed last version on maven central : https://mvnrepository.com/artifact/org.codenarc/CodeNarc) after 6 modifications in my local environment, the maven import and compilation are OK.

What about changelog used in project (https://github.com/cnumr/ecoCode/blob/main/src/codenarc-converter/CodeNarc/CHANGELOG.md) ? it seems that some parts have been copied from original CodeNarc changelog (https://github.com/CodeNarc/CodeNarc/blob/master/CHANGELOG.md until 2.2.0), but for 2.2.1, 2.2.2 and 2.2.3, I don't known what are these changelog modifications.

What do you about the correction ? Can we come back to 2.2.0 ? if yes .. I can create a PR with my modifications.

@jhertout
Copy link
Collaborator

jhertout commented Nov 8, 2022

Hello,

do not change the version of CodeNarc we use. It is a custom version which is built in the source of the project using "src/codenarc-converter".
To build it correctly, you can follow the step 4 here : https://github.com/cnumr/ecoCode/tree/main/src/codenarc-converter
It should create the 2.2.3 dependency locally and then it should be found by maven.
If one of the step in the documentation does not work, please try to clean the git repo (with a git clean -dxf for example) and retry. If an error occured (in the "mvn init" for example), the local jar is not created and maven will try to get the jar from the distant repo the following time. In that case again, please clean the git repo and retry.

We are working on CodeNarc to extract its version from ecoCode in a separate repo to simplify the build but it will be done later.

Thanks

@dedece35
Copy link
Collaborator

dedece35 commented Nov 8, 2022

hello @jhertout ,

thank you for detailed answer.
According to me, I think you should create a ne repository with a version management different from real CodeNarc one. Why ? In order to not adding confusion for developers between real CodeNarc dependency and our custom CodeNarc dependency.
Another thing, why not rename our custom CodeNarc implementation to "CodeNarcEcoCode" for example or use another maven groupId if you want to keep "CodeNarc" name ?
What do you about it ?

@jhertout
Copy link
Collaborator

jhertout commented Nov 8, 2022

hello @dedece35,

I think your two suggestions are good. We are thinking of getting our own CodeNarc fork: a simplified version of the original one since we use a small part of the original whole project that is used to create rules on Groovy projects while we only parse build gradles files.
The CodeNarc project was added a little bit quiclkly in ecoCode because we wanted it for the hackathon at the beginning of the year. I agree that it was not a very good idea but it was the quickest!
Maybe that before moving it from the repo we can rename it to avoid confusion as you say. It just a question of time. I hope I can have some time soon to work again on the project.

Regards.

@dedece35
Copy link
Collaborator

dedece35 commented Nov 8, 2022

Hi @jhertout,
sorry but after testing locally, only step 4 is not OK for me :(

  • command "cd [...]/codenarc-converter/CodeNarc && ./gradlew build -x test" ==> OK
  • command "cd [...]/codenarc-converter && mvn initialize" ==> OK
  • command "cd [...]/codenarc-converter && mvn clean package" ==> not OK, here is the error :
    [ERROR] Failed to execute goal on project sonar-codenarc-converter: Could not resolve dependencies for project fr.cnumr:sonar-codenarc-converter:jar:1.0.0-SNAPSHOT: Could not find artifact org.codenarc:CodeNarc:jar:2.2.3 ...

waiting for an other idea, I comment locally codenarc and android-plugin lines in pom.xml

@dedece35 dedece35 added the plugin:android Specific to the Android plugin label Nov 8, 2022
@jhertout
Copy link
Collaborator

jhertout commented Nov 8, 2022

Have you tried to clean your local maven repo and to clean the git project ? I do not remember how it works exactly but if maven has tried to download CodeNarc one time from the official repo it will retry to use it instead of the one we create locally.

@dedece35
Copy link
Collaborator

dedece35 commented Nov 8, 2022

Indeed, maven uses a local copy (in .m2 directory) if the wanted version exists in it. But if version doesn't exist, maven try to download from maven central and if not OK, tells us that the version was not found.
To clean the local repository won't fix this problem.
To confirm it, I have just tried to clean CodeNarc dependency in ".m2" local directory, and the problem is the same :(

@jhertout
Copy link
Collaborator

jhertout commented Nov 9, 2022

I worked on the project two weeks ago and I had the same problem. The "git clean -dxf" command did the job for me.
I have to work on the PR on CodeNarc #153 in a coming week (I don't know when exactly). I will try at this point to see if I can change the way CodeNarc is integrated or at least understand the actual behavior.
Until then, just keep the android plugin commented. I'm sorry I have no solution and no time at this point :(

@MP-Aubay
Copy link
Collaborator

MP-Aubay commented Nov 9, 2022

Hi,

You don't have to manually execute step 4 of https://github.com/cnumr/ecoCode/tree/main/src/codenarc-converter, during hackaton a script was created to do this automatically.

You can follow the step Preliminary steps (only Android) here : https://github.com/cnumr/ecoCode/blob/main/src/INSTALL.md

Using one of this script :
https://github.com/cnumr/ecoCode/blob/main/src/prepare-codenarc
https://github.com/cnumr/ecoCode/blob/main/src/prepare-codenarc.bat

Agreed with @dedece35 to remove CodeNarc from EcoCode :)

@dedece35
Copy link
Collaborator

dedece35 commented Nov 9, 2022

Hi @MP-Aubay @jhertout

I confirm that if I execute prepare-codenarc then build the project with maven (ex : mvn clean compile), now it's OK : the version 2.2.3 is generated and stored in my local ".m2" maven directory to be used as dependency.
Just following the install documentation .... :p

It's just confusing to have the real maven dependency used with a version that not really exists in maven central ... but generated by our process. Thus, we will discuss internally about to remove CodeNarc project from EcoCode plugin and create a real versionning system for it (and stored in maven central).

I close the issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
plugin:android Specific to the Android plugin
Projects
None yet
Development

No branches or pull requests

4 participants