cnumr/ecoCode

Can't build CodeNarc

Closed this issue · 6 comments

I am trying to install ecocode on my environement, but i can't build CodeNarc.
I proceeded the ./prepare-codenarc step correctly (I suppose).

But when I do the mvn clean install I got this error :
Could not resolve dependencies for project fr.cnumr:sonar-codenarc-converter:jar:1.0.0-SNAPSHOT: org.codenarc:CodeNarc:jar:2.2.2 was not found in https://repo.maven
.apache.org/maven2 during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced

Is someone could help me on this please ?

Hi @Sophilozoff ,

I suppose you are using Windows, as i can reproduce only with Windows.

First of all, I suggest you remove the folder codenarc in your .m2/org/.

The next step is to modify the prepare-codenarc.bat file, to this :

REM == Define CodeNarc version
set codenarc_version=2.2.2

REM == Build CodeNarc
cd codenarc-converter/CodeNarc
call ./gradlew build -x test

REM == Deploy to local repository
mvn -B install:install-file -Dfile=build/libs/CodeNarc-%codenarc_version%.jar -DgroupId=org.codenarc -DartifactId=CodeNarc -Dversion=%codenarc_version% -Dpackaging=jar

The call is important here, because gradlew is a script and calling it without call will end the prepare-codenarc script, not executing the mvn install command.

I will create a PR to fix this.

Regards,
Mikaël

I am hitting similar error on macOS 13.0 arm64. Would appreciate some help.

@MP-Aubay, @olegoaer, @jhertout
please see ... my comment in #170 about this subject
these two issues are the same problem for me.

Hi @lmilbaum ,

When you execute ./prepare-codenarc, do you see in log after gradle a maven command ?

Could you manually execute command from ./prepare-codenarc and verify your local .m2 to see if the jar is in org/codenarc/CodeNarc ?

please see my comment in #170

@MP-Aubay Thanks for your comment. I've managed to find a way to make it work. AFAIR, it took me few tweaks to find a successful path.