cnumr / ecoCode

Reduce the environmental footprint of your software applications with this cutting-edge sonarQube plugin
GNU General Public License v3.0
62 stars 48 forks source link

Can't build CodeNarc #149

Closed Sophilozoff closed 1 year ago

Sophilozoff commented 2 years ago

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 ?

MP-Aubay commented 2 years ago

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

lmilbaum commented 2 years ago

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

dedece35 commented 1 year ago

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

MP-Aubay commented 1 year ago

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 ?

dedece35 commented 1 year ago

please see my comment in #170

lmilbaum commented 1 year ago

@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.