如何配置 Android Studio 以在项目中包含包含 pom.xml 的配置文件夹?

jis*_*ava 8 teamcity gradle maven kotlin android-studio

我正在尝试使用 Kotlin DSL https://blog.jetbrains.com/teamcity/2019/03/configuration-as-code-part-1-getting-started-with-kotlin-设置 TeamCity“项目配置即代码”单线/

我在 TeamCity 中创建了一个示例项目,指向一个空的 Android Studio 项目,其中包含我在 Github 中发布的空活动。我已经在 TeamCity GUI 中为该项目启用了 Kotlin DSL 配置。

在 TeamCity.teamcity通过包含pom.xml. 此文件夹是顶级项目文件夹,与app模块一起位于根目录中。但是,当我在settings.ktsIDE 中检查代码时,并没有给我任何提示。我无法对 Kotlin DSL 配置代码使用自动完成功能,我的 IDE 中没有任何特殊格式或代码时间 lint 检查

我试图按照上述博客指南进行操作,但不幸的是我无法右键单击该pom.xml文件并且Add as Maven在 Android Studio中看不到任何选项。此外,我看不到任何外部库被添加到我的与 TeamCity DSL 相关的项目中,这当然意味着pom.xml文件的依赖项没有得到处理。

我正在使用 Android Studio 4.0

这是pom.xmlTeamCity 添加到我的 Android Studio 项目(在.teamcity文件夹下):

<?xml version="1.0"?>
<project>
  <modelVersion>4.0.0</modelVersion>
  <name>KotlinTeamcityDSL Config DSL Script</name>
  <groupId>KotlinTeamcityDSL</groupId>
  <artifactId>KotlinTeamcityDSL_dsl</artifactId>
  <version>1.0-SNAPSHOT</version>

  <parent>
    <groupId>org.jetbrains.teamcity</groupId>
    <artifactId>configs-dsl-kotlin-parent</artifactId>
    <version>1.0-SNAPSHOT</version>
  </parent>

  <repositories>
    <repository>
      <id>jetbrains-all</id>
      <url>https://download.jetbrains.com/teamcity-repository</url>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
    <repository>
      <id>teamcity-server</id>
      <url>http://localhost:8111/app/dsl-plugins-repository</url>
      <snapshots>
        <enabled>true</enabled>
      </snapshots>
    </repository>
  </repositories>

  <pluginRepositories>
    <pluginRepository>
      <id>JetBrains</id>
      <url>https://download.jetbrains.com/teamcity-repository</url>
    </pluginRepository>
  </pluginRepositories>

  <build>
    <sourceDirectory>${basedir}</sourceDirectory>
    <plugins>
      <plugin>
        <artifactId>kotlin-maven-plugin</artifactId>
        <groupId>org.jetbrains.kotlin</groupId>
        <version>${kotlin.version}</version>

        <configuration/>
        <executions>
          <execution>
            <id>compile</id>
            <phase>process-sources</phase>
            <goals>
              <goal>compile</goal>
            </goals>
          </execution>
          <execution>
            <id>test-compile</id>
            <phase>process-test-sources</phase>
            <goals>
              <goal>test-compile</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.jetbrains.teamcity</groupId>
        <artifactId>teamcity-configs-maven-plugin</artifactId>
        <version>${teamcity.dsl.version}</version>
        <configuration>
          <format>kotlin</format>
          <dstDir>target/generated-configs</dstDir>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <dependencies>
    <dependency>
      <groupId>org.jetbrains.teamcity</groupId>
      <artifactId>configs-dsl-kotlin</artifactId>
      <version>${teamcity.dsl.version}</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.jetbrains.teamcity</groupId>
      <artifactId>configs-dsl-kotlin-plugins</artifactId>
      <version>1.0-SNAPSHOT</version>
      <type>pom</type>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.jetbrains.kotlin</groupId>
      <artifactId>kotlin-stdlib-jdk8</artifactId>
      <version>${kotlin.version}</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.jetbrains.kotlin</groupId>
      <artifactId>kotlin-script-runtime</artifactId>
      <version>${kotlin.version}</version>
      <scope>compile</scope>
    </dependency>
  </dependencies>
</project>
Run Code Online (Sandbox Code Playgroud)

您能帮我如何正确设置此pom.xml配置以在 Android Studio 中使用吗?Android Studio 项目默认使用 Gradle