SpoonLabs / coming

A tool for mining commits from Git repositories and diffs to automatically extract code change pattern instances and features with ast analysis
https://hal.inria.fr/hal-00861883/file/paper-short.pdf
MIT License
92 stars 33 forks source link

Maven fails to resolve dependencies #256

Closed csuvikv closed 8 months ago

csuvikv commented 9 months ago

Cannot use the tool, the code on master branch fails to resolve maven dependencies.

I am using Java 1.8: `

java -version openjdk version "1.8.0_392" OpenJDK Runtime Environment (Temurin)(build 1.8.0_392-b08) OpenJDK 64-Bit Server VM (Temurin)(build 25.392-b08, mixed mode) `

and Maven 3.9.6: `

mvn -v Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae) Maven home: debug.txt\apache-maven-3.9.6 Java version: 1.8.0_392, vendor: Temurin, runtime: C:\Program Files\Eclipse Adoptium\jdk-8.0.392.8-hotspot\jre Default locale: en_GB, platform encoding: Cp1252 OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows" `

When I try to install the dependencies using mvn install -DskipTests I get the following error:

[ERROR] Failed to execute goal on project coming: Could not resolve dependencies for project com.github.spoonlabs:coming:jar:0-SNAPSHOT: Failed to collect dependencies at fr.inria.gforge.spoon.labs:gumtree-spoon-ast-diff:jar:1.23 -> fr.inria.gforge.spoon:spoon-core:jar:8.0.0 -> org.eclipse.jdt:org.eclipse.jdt.core:jar:3.16.0 -> org.eclipse.platform:org.eclipse.core.resources:jar:3.12.0 -> org.eclipse.platform:org.eclipse.core.expressions:jar:3.5.100 -> org.eclipse.platform:org.eclipse.core.runtime:jar:3.12.0 -> org.eclipse.platform:org.eclipse.equinox.preferences:jar:3.10.1 -> org.osgi:org.osgi.service.prefs:jar:1.1.1-SNAPSHOT: Failed to read artifact descriptor for org.osgi:org.osgi.service.prefs:jar:1.1.1-SNAPSHOT: The following artifacts could not be resolved: org.osgi:org.osgi.service.prefs:pom:1.1.1-SNAPSHOT (absent): Could not transfer artifact org.osgi:org.osgi.service.prefs:pom:1.1.1-SNAPSHOT from/to maven-default-http-blocker (http://0.0.0.0/): status code: 500, reason phrase: Internal Server Error (500) -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

The full debug log is attached. Could you please check? I also tried the branch monperrus-patch-1, but it also fails unfortunately.

monperrus commented 9 months ago

ping @martinezmatias could you have a look? thanks!

monperrus commented 9 months ago

merged https://github.com/SpoonLabs/coming/pull/255

could you try again?

csuvikv commented 9 months ago

Still get the error>

[INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3.289 s [INFO] Finished at: 2024-01-11T10:27:37+01:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal on project coming: Could not resolve dependencies for project com.github.spoonlabs:coming:jar:0-SNAPSHOT: Failed to collect dependencies at br.ufu.lascam:automatic-diff-dissection:jar:1.1-SNAPSHOT -> fr.inria.gforge.spoon.labs:gumtree-spoon-ast-diff:jar:1.7 -> fr.inria.gforge.spoon:spoon-core:jar:7.0.0 -> org.eclipse.jdt:org.eclipse.jdt.core:jar:3.13.102 -> org.eclipse.platform:org.eclipse.core.resources:jar:3.12.0 -> org.eclipse.platform:org.eclipse.core.expressions:jar:3.5.100 -> org.eclipse.platform:org.eclipse.core.runtime:jar:3.12.0 -> org.eclipse.platform:org.eclipse.equinox.preferences:jar:3.10.1 -> org.osgi:org.osgi.service.prefs:jar:1.1.1-SNAPSHOT: Failed to read artifact descriptor for org.osgi:org.osgi.service.prefs:jar:1.1.1-SNAPSHOT: The following artifacts could not be resolved: org.osgi:org.osgi.service.prefs:pom:1.1.1-SNAPSHOT (absent): Could not transfer artifact org.osgi:org.osgi.service.prefs:pom:1.1.1-SNAPSHOT from/to maven-default-http-blocker (http://0.0.0.0/): status code: 500, reason phrase: Internal Server Error (500) -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

Here is the output with -X switch: debug.txt

monperrus commented 9 months ago

a fresh "mvn clean package" on master resolves all depedencies on my machine.

(but compilation fails afterwards because outdated Gumtree classes)

csuvikv commented 9 months ago

Indeed, after mvn clean package, I get compilation error. Now same with mvn install -DskipTests:

[INFO] Scanning for projects... [WARNING] [WARNING] Some problems were encountered while building the effective model for com.github.spoonlabs:coming:jar:0-SNAPSHOT [WARNING] 'repositories.repository.id' must not contain any of these characters \/:"<>|?* but found / @ line 181, column 8 [WARNING] 'repositories.repository.id' must not contain any of these characters \/:"<>|?* but found / @ line 187, column 8 [WARNING] [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build. [WARNING] [WARNING] For this reason, future Maven versions might no longer support building such malformed projects. [WARNING] [INFO] [INFO] --------------------< com.github.spoonlabs:coming >--------------------- [INFO] Building coming-parent 0-SNAPSHOT [INFO] from pom.xml [INFO] --------------------------------[ jar ]--------------------------------- [WARNING] The POM for org.osgi:org.osgi.service.prefs:jar:1.1.1-SNAPSHOT is missing, no dependency information available [INFO] [INFO] --- resources:3.3.1:resources (default-resources) @ coming --- [INFO] Copying 3306 resources from src\main\resources to target\classes [INFO] [INFO] --- compiler:3.1:compile (default-compile) @ coming --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 179 source files to coming\target\classes [INFO] ------------------------------------------------------------- [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] coming/src/main/java/fr/inria/coming/utils/VariableResolver.java:[11,26] cannot access spoon.reflect.code.CtBlock bad class file: .m2\repository\fr\inria\gforge\spoon\spoon-core\10.3.0\spoon-core-10.3.0.jar(spoon/reflect/code/CtBlock.class) class file has wrong version 55.0, should be 52.0 Please remove or make sure it appears in the correct subdirectory of the classpath. [INFO] 1 error [INFO] ------------------------------------------------------------- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 7.114 s [INFO] Finished at: 2024-01-12T11:38:45+01:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project coming: Compilation failure [ERROR] coming/src/main/java/fr/inria/coming/utils/VariableResolver.java:[11,26] cannot access spoon.reflect.code.CtBlock [ERROR] bad class file: .m2\repository\fr\inria\gforge\spoon\spoon-core\10.3.0\spoon-core-10.3.0.jar(spoon/reflect/code/CtBlock.class) [ERROR] class file has wrong version 55.0, should be 52.0 [ERROR] Please remove or make sure it appears in the correct subdirectory of the classpath. [ERROR] [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

monperrus commented 8 months ago

yes, this is because coming still uses gumtree2 while gumtree-spoon uses gt3.

@martinezmatias wdyt?

martinezmatias commented 8 months ago

yes, this is because coming still uses gumtree2 while gumtree-spoon uses gt3.

@monperrus If I am not wrong, after the merge of https://github.com/SpoonLabs/coming/pull/255/files, Coming should use gt3 because version 1.63 of GTSpoon uses GT3 (according to the release date)

In any case, I wonder to what extent this issue is related to the Java version used:

RROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project coming: Compilation failure [ERROR]  coming/src/main/java/fr/inria/coming/utils/VariableResolver.java:[11,26] cannot access spoon.reflect.code.CtBlock [ERROR]   bad class file: .m2\repository\fr\inria\gforge\spoon\spoon-core\10.3.0\spoon-core-10.3.0.jar(spoon/reflect/code/CtBlock.class) [ERROR]     class file has wrong version 55.0, should be 52.0 [ERROR]     

As @csuvikv is using Java8, the issue should be to fixed by using Java 11.

WDYT?

monperrus commented 8 months ago

If I am not wrong, after the merge of https://github.com/SpoonLabs/coming/pull/255/files, Coming should use gt3 because version 1.63 of GTSpoon uses GT3 (according to the release date)

agree. for some reason, we still have a dependency to disappeared ITree, would you be able to fix this?

csuvikv commented 8 months ago

@martinezmatias I get different error when using Java 11:

[INFO] --------------------< com.github.spoonlabs:coming >--------------------- [INFO] Building coming-parent 0-SNAPSHOT [INFO] from pom.xml [INFO] --------------------------------[ jar ]--------------------------------- [WARNING] The POM for org.osgi:org.osgi.service.prefs:jar:1.1.1-SNAPSHOT is missing, no dependency information available [INFO] [INFO] --- resources:3.3.1:resources (default-resources) @ coming --- [INFO] Copying 3306 resources from src\main\resources to target\classes [INFO] [INFO] --- compiler:3.1:compile (default-compile) @ coming --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 179 source files to D:\Documents\git\coming\target\classes [INFO] ------------------------------------------------------------- [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] /D:/Documents/git/coming/src/main/java/fr/inria/coming/utils/VariableResolver.java:[11,26] cannot access spoon.reflect.code.CtBlock bad class file: C:\Users\csuvikv\.m2\repository\fr\inria\gforge\spoon\spoon-core\10.3.0\spoon-core-10.3.0.jar(spoon/reflect/code/CtBlock.class) class file has wrong version 55.0, should be 52.0 Please remove or make sure it appears in the correct subdirectory of the classpath. [INFO] 1 error [INFO] ------------------------------------------------------------- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 7.241 s [INFO] Finished at: 2024-01-16T09:28:17+01:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project coming: Compilation failure [ERROR] coming/src/main/java/fr/inria/coming/utils/VariableResolver.java:[11,26] cannot access spoon.reflect.code.CtBlock [ERROR] bad class file: .m2\repository\fr\inria\gforge\spoon\spoon-core\10.3.0\spoon-core-10.3.0.jar(spoon/reflect/code/CtBlock.class) [ERROR] class file has wrong version 55.0, should be 52.0 [ERROR] Please remove or make sure it appears in the correct subdirectory of the classpath. [ERROR] [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

monperrus commented 8 months ago

https://github.com/SpoonLabs/coming/pull/257 resolves dependencies, compiles and runs tests on Java 17.

monperrus commented 8 months ago

Closing per https://github.com/SpoonLabs/coming/pull/257

csuvikv commented 8 months ago

@monperrus Unfortunately it doesn't solve the issue for me. I updated the maven settings.xml by adding: `

br.ufu.lascam csuvikv MY_TOKEN

`

Updated Java to 17, fetched master again: mvn --version Apache Maven 3.9.6 (bc0240f3c744dd6b6ec2920b3cd08dcc295161ae) Maven home: C:\Program Files\Eclipse Adoptium\apache-maven-3.9.6 Java version: 17.0.10, vendor: Eclipse Adoptium, runtime: C:\Program Files\Eclipse Adoptium\jdk-17.0.10.7-hotspot Default locale: en_GB, platform encoding: Cp1252 OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

After running mvn install -DskipTests I get: [INFO] Scanning for projects... [WARNING] [WARNING] Some problems were encountered while building the effective model for com.github.spoonlabs:coming:jar:0-SNAPSHOT [WARNING] 'repositories.repository.id' must not contain any of these characters \/:"<>|?* but found / @ line 186, column 8 [WARNING] 'repositories.repository.id' must not contain any of these characters \/:"<>|?* but found / @ line 192, column 8 [WARNING] [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build. [WARNING] [WARNING] For this reason, future Maven versions might no longer support building such malformed projects. [WARNING] [INFO] [INFO] --------------------< com.github.spoonlabs:coming >--------------------- [INFO] Building coming-parent 0-SNAPSHOT [INFO] from pom.xml [INFO] --------------------------------[ jar ]--------------------------------- Downloading from brufulascam: https://maven.pkg.github.com/lascam-UFU/automatic-diff-dissection/br/ufu/lascam/automatic-diff-dissection/1.1/automatic-diff-dissection-1.1.pom Downloading from brufulascam: https://maven.pkg.github.com/lascam-UFU/automatic-diff-dissection/org/apache/maven/maven-model/maven-metadata.xml [WARNING] Could not transfer metadata org.apache.maven:maven-model/maven-metadata.xml from/to brufulascam (https://maven.pkg.github.com/lascam-UFU/automatic-diff-dissection): status code: 401, reason phrase: Unauthorized (401) [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.716 s [INFO] Finished at: 2024-01-22T11:06:03+01:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal on project coming: Could not resolve dependencies for project com.github.spoonlabs:coming:jar:0-SNAPSHOT: Failed to collect dependencies at br.ufu.lascam:automatic-diff-dissection:jar:1.1: Failed to read artifact descriptor for br.ufu.lascam:automatic-diff-dissection:jar:1.1: The following artifacts could not be resolved: br.ufu.lascam:automatic-diff-dissection:pom:1.1 (absent): Could not transfer artifact br.ufu.lascam:automatic-diff-dissection:pom:1.1 from/to brufulascam (https://maven.pkg.github.com/lascam-UFU/automatic-diff-dissection): status code: 401, reason phrase: Unauthorized (401) -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

monperrus commented 8 months ago

you have to create a Github token on your own, with capability read:packages.

csuvikv commented 8 months ago

Yes, did that. Instead of "MY_TOKEN" in the settings.xml the real generated token is there. Even though I get the error.

monperrus commented 8 months ago

Have you changed "monperrus" by your own github user?

csuvikv commented 8 months ago

Yes, this is my configuration: `

br.ufu.lascam csuvikv MY_TOKEN

`

MY_TOKEN is the personal token I generated here on Github.

monperrus commented 8 months ago

OK, simple bug: replace |br.ufu.lascam by ||brufulascam|

csuvikv commented 8 months ago

Indeed, thank you for the support, really appreciate it! Consider updating the README. ;)

monperrus commented 8 months ago

done, see https://github.com/SpoonLabs/coming/commit/1d5caa06d8c96385b3a69fd83ce8c12160d57325