TransWikia.com

How to configure Android Studio to include configuration folder containing pom.xml in project?

Stack Overflow Asked by jisasava on November 4, 2021

I am trying to setup a TeamCity "project configuration as code" using Kotlin DSL https://blog.jetbrains.com/teamcity/2019/03/configuration-as-code-part-1-getting-started-with-kotlin-dsl/

I’ve created a sample project in TeamCity pointing to just an empty Android Studio project with empty Activity which I ‘ve published in the Github. I’ve enabled Kotlin DSL configuration in the TeamCity GUI for that project.

After that TeamCity has commited a .teamcity folder to my Android Studio project via Git containing pom.xml. This folder is a top project folder and resides in the root along with the app module. However, when I am inspecting the code in settings.kts the IDE is not giving me any hints. I cannot use the autocompletion for the Kotlin DSL configuration code, I don’t have any special formatting or code time lint checks in my IDE

I was trying to follow the above mentioned blog guidance but unfortunately I cannot right-click on the pom.xml file and don’t see any option to Add as Mavenin Android Studio.
In addition I cannot see any External Libraries being added to my project related to TeamCity DSL which of course means that the dependencies from pom.xml file were not handled.

I am using Android Studio 4.0

This is a pom.xml which TeamCity added to my Android Studio project (under .teamcity folder):

<?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>

Can you please help me how I should properly setup this pom.xml configuration to be usable in Android Studio? Android Studio project uses Gradle by default

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP