Skip to content

Commit 4f2f3e0

Browse files
authored
Project for checking compatibility with Maven and JPS on CI (#5201)
Will be added [on CI](https://teamcity.jetbrains.com/buildConfiguration/JetBrainsPublicProjects_Compose_Task4ValidateTemplatesTutorials/4947977?buildTab=log&focusLine=1209&logView=flowAware) JPS (build tool for IntelliJ) uses POM files for dependency management. Occasianally, there are errors in POM files, which leads to inability to use Compose in IntelliJ. To avoid this, better to run CI checks. This fails: ``` mvn install exec:java -Dexec.mainClass="MainKt" -Dkotlin.version=2.0.21 -Dcompose.version=1.8.0-alpha01 ``` (https://youtrack.jetbrains.com/issue/CMP-7406/CMP-1.8.0-alpha01-doesnt-work-with-JPS-and-Maven) This don't: ``` mvn install exec:java -Dexec.mainClass="MainKt" -Dkotlin.version=2.0.21 -Dcompose.version=1.8.0+dev2001 ```
1 parent 2af2f00 commit 4f2f3e0

File tree

5 files changed

+243
-0
lines changed

5 files changed

+243
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea
5+
/.idea/caches
6+
/.idea/libraries
7+
/.idea/modules.xml
8+
/.idea/workspace.xml
9+
/.idea/navEditor.xml
10+
/.idea/assetWizardSettings.xml
11+
.DS_Store
12+
build/
13+
target/
14+
/captures
15+
.externalNativeBuild
16+
.cxx
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
The purpose of this test project is to check if Compose Multiplatform is resolvable via pom files, which are used by JPS, which is used by IntelliJ
2+
3+
```
4+
mvn install exec:java -Dexec.mainClass="MainKt" -Dkotlin.version=2.1.0 -Dcompose.version=1.8.0-alpha02
5+
```
Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>org.example</groupId>
8+
<artifactId>maven-test-project</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
11+
<properties>
12+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
13+
<kotlin.code.style>official</kotlin.code.style>
14+
<kotlin.compiler.jvmTarget>1.8</kotlin.compiler.jvmTarget>
15+
<kotlin.version>2.1.0</kotlin.version>
16+
<compose.version>1.8.0-alpha02</compose.version>
17+
</properties>
18+
19+
<repositories>
20+
<repository>
21+
<id>mavenCentral</id>
22+
<url>https://repo1.maven.org/maven2/</url>
23+
</repository>
24+
<repository>
25+
<id>gMaven</id>
26+
<url>https://maven.google.com/</url>
27+
</repository>
28+
<repository>
29+
<id>composeDev</id>
30+
<url>https://maven.pkg.jetbrains.space/public/p/compose/dev</url>
31+
</repository>
32+
</repositories>
33+
34+
<build>
35+
<sourceDirectory>src/main/kotlin</sourceDirectory>
36+
<testSourceDirectory>src/test/kotlin</testSourceDirectory>
37+
<plugins>
38+
<plugin>
39+
<groupId>org.jetbrains.kotlin</groupId>
40+
<artifactId>kotlin-maven-plugin</artifactId>
41+
<version>${kotlin.version}</version>
42+
<executions>
43+
<execution>
44+
<id>compile</id>
45+
<phase>compile</phase>
46+
<goals>
47+
<goal>compile</goal>
48+
</goals>
49+
</execution>
50+
<execution>
51+
<id>test-compile</id>
52+
<phase>test-compile</phase>
53+
<goals>
54+
<goal>test-compile</goal>
55+
</goals>
56+
</execution>
57+
</executions>
58+
<configuration>
59+
<args>org.jetbrains.kotlin:kotlin-compose-compiler-plugin-embeddable
60+
<arg>-Xplugin=${user.home}/.m2/repository/org/jetbrains/kotlin/kotlin-compose-compiler-plugin/${kotlin.version}/kotlin-compose-compiler-plugin-${kotlin.version}.jar</arg>
61+
</args>
62+
</configuration>
63+
</plugin>
64+
<plugin>
65+
<artifactId>maven-surefire-plugin</artifactId>
66+
<version>2.22.2</version>
67+
</plugin>
68+
<plugin>
69+
<artifactId>maven-failsafe-plugin</artifactId>
70+
<version>2.22.2</version>
71+
</plugin>
72+
<plugin>
73+
<groupId>org.codehaus.mojo</groupId>
74+
<artifactId>exec-maven-plugin</artifactId>
75+
<version>1.6.0</version>
76+
<configuration>
77+
<mainClass>MainKt</mainClass>
78+
</configuration>
79+
</plugin>
80+
</plugins>
81+
</build>
82+
83+
<dependencies>
84+
<dependency>
85+
<groupId>org.jetbrains.kotlin</groupId>
86+
<artifactId>kotlin-test-junit5</artifactId>
87+
<version>${kotlin.version}</version>
88+
<scope>test</scope>
89+
</dependency>
90+
<dependency>
91+
<groupId>org.junit.jupiter</groupId>
92+
<artifactId>junit-jupiter</artifactId>
93+
<version>5.10.0</version>
94+
<scope>test</scope>
95+
</dependency>
96+
<dependency>
97+
<groupId>org.jetbrains.kotlin</groupId>
98+
<artifactId>kotlin-stdlib</artifactId>
99+
<version>${kotlin.version}</version>
100+
</dependency>
101+
<dependency>
102+
<groupId>org.jetbrains.compose.material3</groupId>
103+
<artifactId>material3-desktop</artifactId>
104+
<version>${compose.version}</version>
105+
</dependency>
106+
107+
<dependency>
108+
<groupId>org.jetbrains.compose.desktop</groupId>
109+
<artifactId>desktop-jvm-windows-x64</artifactId>
110+
<version>${compose.version}</version>
111+
<type>pom</type>
112+
<exclusions>
113+
<exclusion>
114+
<groupId>org.jetbrains.compose.desktop</groupId>
115+
<artifactId>desktop</artifactId>
116+
</exclusion>
117+
</exclusions>
118+
</dependency>
119+
<dependency>
120+
<groupId>org.jetbrains.compose.desktop</groupId>
121+
<artifactId>desktop-jvm-windows-arm64</artifactId>
122+
<version>${compose.version}</version>
123+
<type>pom</type>
124+
<exclusions>
125+
<exclusion>
126+
<groupId>org.jetbrains.compose.desktop</groupId>
127+
<artifactId>desktop</artifactId>
128+
</exclusion>
129+
</exclusions>
130+
</dependency>
131+
132+
<dependency>
133+
<groupId>org.jetbrains.compose.desktop</groupId>
134+
<artifactId>desktop-jvm-linux-x64</artifactId>
135+
<version>${compose.version}</version>
136+
<type>pom</type>
137+
<exclusions>
138+
<exclusion>
139+
<groupId>org.jetbrains.compose.desktop</groupId>
140+
<artifactId>desktop</artifactId>
141+
</exclusion>
142+
</exclusions>
143+
</dependency>
144+
<dependency>
145+
<groupId>org.jetbrains.compose.desktop</groupId>
146+
<artifactId>desktop-jvm-linux-arm64</artifactId>
147+
<version>${compose.version}</version>
148+
<type>pom</type>
149+
<exclusions>
150+
<exclusion>
151+
<groupId>org.jetbrains.compose.desktop</groupId>
152+
<artifactId>desktop</artifactId>
153+
</exclusion>
154+
</exclusions>
155+
</dependency>
156+
157+
<dependency>
158+
<groupId>org.jetbrains.compose.desktop</groupId>
159+
<artifactId>desktop-jvm-macos-x64</artifactId>
160+
<version>${compose.version}</version>
161+
<type>pom</type>
162+
<exclusions>
163+
<exclusion>
164+
<groupId>org.jetbrains.compose.desktop</groupId>
165+
<artifactId>desktop</artifactId>
166+
</exclusion>
167+
</exclusions>
168+
</dependency>
169+
<dependency>
170+
<groupId>org.jetbrains.compose.desktop</groupId>
171+
<artifactId>desktop-jvm-macos-arm64</artifactId>
172+
<version>${compose.version}</version>
173+
<type>pom</type>
174+
<exclusions>
175+
<exclusion>
176+
<groupId>org.jetbrains.compose.desktop</groupId>
177+
<artifactId>desktop</artifactId>
178+
</exclusion>
179+
</exclusions>
180+
</dependency>
181+
182+
<dependency>
183+
<groupId>org.jetbrains.kotlin</groupId>
184+
<artifactId>kotlin-compose-compiler-plugin</artifactId>
185+
<version>${kotlin.version}</version>
186+
</dependency>
187+
</dependencies>
188+
189+
</project>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import androidx.compose.material3.Button
2+
import androidx.compose.material3.MaterialTheme
3+
import androidx.compose.material3.Text
4+
import androidx.compose.runtime.LaunchedEffect
5+
import androidx.compose.runtime.getValue
6+
import androidx.compose.runtime.mutableStateOf
7+
import androidx.compose.runtime.remember
8+
import androidx.compose.runtime.setValue
9+
import androidx.compose.ui.window.Window
10+
import androidx.compose.ui.window.application
11+
import kotlinx.coroutines.delay
12+
13+
fun main() = application {
14+
Window(onCloseRequest = ::exitApplication) {
15+
LaunchedEffect(Unit) {
16+
delay(1000)
17+
exitApplication()
18+
}
19+
20+
var text by remember { mutableStateOf("Hello, World!") }
21+
22+
MaterialTheme {
23+
Button(onClick = {
24+
text = "Hello, Desktop!"
25+
}) {
26+
Text(text)
27+
}
28+
}
29+
}
30+
}

tools/replaceVersion.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,13 @@ replaceVersion() {
4747
replaceVersionInFile() {
4848
echo "Replace in $1"
4949
replaceVersion '^compose.version=.*' 'compose.version='"$COMPOSE_VERSION"'' $1
50+
replaceVersion '<compose.version>.*<\/compose.version>' '<compose.version>'"$COMPOSE_VERSION"'<\/compose.version>' $1
5051
replaceVersion '^COMPOSE_CORE_VERSION=.*' 'COMPOSE_CORE_VERSION='"$COMPOSE_VERSION"'' $1
5152
replaceVersion '^COMPOSE_WEB_VERSION=.*' 'COMPOSE_WEB_VERSION='"$COMPOSE_VERSION"'' $1
5253
replaceVersion 'id("org.jetbrains.compose") version ".*"' 'id("org.jetbrains.compose") version "'"$COMPOSE_VERSION"'"' $1
5354
replaceVersion '"org.jetbrains.compose:compose-gradle-plugin:.*"' '"org.jetbrains.compose:compose-gradle-plugin:'"$COMPOSE_VERSION"'"' $1
5455
replaceVersion '^kotlin.version=.*' 'kotlin.version='"$KOTLIN_VERSION"'' $1
56+
replaceVersion '<kotlin.version>.*<\/kotlin.version>' '<kotlin.version>'"$KOTLIN_VERSION"'<\/kotlin.version>' $1
5557
replaceVersion '^compose.tests.compiler.compatible.kotlin.version=.*' 'compose.tests.compiler.compatible.kotlin.version='"$KOTLIN_VERSION"'' $1
5658
replaceVersion '^compose.tests.js.compiler.compatible.kotlin.version=.*' 'compose.tests.js.compiler.compatible.kotlin.version='"$KOTLIN_VERSION"'' $1
5759
replaceVersion 'kotlin("multiplatform") version ".*"' 'kotlin("multiplatform") version "'"$KOTLIN_VERSION"'"' $1
@@ -65,5 +67,6 @@ replaceVersionInFolder() {
6567
for folder in "${folders[@]}"
6668
do
6769
replaceVersionInFolder $folder "**gradle.properties"
70+
replaceVersionInFolder $folder "**pom.xml"
6871
replaceVersionInFolder $folder "**README.md"
6972
done

0 commit comments

Comments
 (0)