kotlinx / ast

Generic AST parsing library for kotlin multiplatform
Apache License 2.0
326 stars 23 forks source link

How do I rely on this project on Maven? #99

Closed heyuxiang1996 closed 1 year ago

heyuxiang1996 commented 1 year ago

<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

4.0.0
<groupId>org.example</groupId>
<artifactId>untitled</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
    <maven.compiler.source>11</maven.compiler.source>
    <maven.compiler.target>11</maven.compiler.target>
</properties>

<dependencies>
    <!-- https://mvnrepository.com/artifact/com.github.kotlinx.ast/grammar-kotlin-parser-common-jvm -->
    <dependency>
        <groupId>com.github.kotlinx.ast</groupId>
        <artifactId>grammar-kotlin-parser-common-jvm</artifactId>
        <version>57524bbb21</version>
    </dependency>
</dependencies>

heyuxiang1996 commented 1 year ago

This is my pom file code, and the IDE prompts that it cannot be loaded (refresh also cannot resolve). Looking forward to your reply, thank you very much!

heyuxiang1996 commented 1 year ago

Does kotlinx.ast only support kotlin projects? Can Java projects built using Maven use it?

LiuShiYi1027 commented 1 year ago

I have encountered the same problem.

here is my pom.xml, but it can not import the class in the java file.

image

the jar file has been imported in Libraries:

image
akarahdev commented 1 year ago

Hi! I had a similar issue. For anyone who is here sometime in the future, where it says the repository is valid but it won't work in your code, try this:

  1. Right click on your project name - mine is CKotlin. image
  2. It should bring up this menu image
  3. Go into Maven and select Reload Project. image

This effectively just tells Maven to re-install every import from the looks of it. I don't know if this will work for others, but try it anyways I guess.