-
Notifications
You must be signed in to change notification settings - Fork 133
Getting started
Leonid Stashevsky edited this page Mar 18, 2021
·
19 revisions
You have to add the repository and dependencies
repositories {
maven { url "https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven" }
}
dependencies {
//Fill this in with the version of kotlinx in use in your project
def kotlinx_html_version = "your_version_here"
// include for server side
implementation("org.jetbrains.kotlinx:kotlinx-html-jvm:${kotlinx_html_version}")
// include for client-side
implementation("org.jetbrains.kotlinx:kotlinx-html-js:${kotlinx_html_version}")
// note: most likely you don't need to include them both
}
To get it working with maven you need to add Public space repository
<repository>
<id>kotlinx-html</id>
<name>kotlinx-html</name>
<url>https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven</url>
</repository>
For server-side development you can add the following dependency:
<dependency>
<groupId>org.jetbrains.kotlinx</groupId>
<artifactId>kotlinx-html-jvm</artifactId>
<version>${kotlinx.html.version}</version>
</dependency>
For client-side (JavaScript) you need this one:
<dependency>
<groupId>org.jetbrains.kotlinx</groupId>
<artifactId>kotlinx-html-js</artifactId>
<version>${kotlinx.html.version}</version>
</dependency>
If you are building web application with war plugin you can use overlays to pack JavaScripts from webjar like this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<dependentWarExcludes>META-INF/*,META-INF/**/*,*meta.js,**/*class</dependentWarExcludes>
<webXml>src/main/resources/web.xml</webXml>
<webResources>
<resource>
<directory>src/main/webapp</directory>
</resource>
</webResources>
<overlays>
<overlay>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-js-library</artifactId>
<type>jar</type>
<includes>
<include>kotlin.js</include>
</includes>
<targetPath>js/</targetPath>
</overlay>
<overlay>
<groupId>org.jetbrains.kotlinx</groupId>
<artifactId>kotlinx-html-assembly</artifactId>
<classifier>webjar</classifier>
<type>jar</type>
<targetPath>js/</targetPath>
</overlay>
</overlays>
</configuration>
</plugin>
npm install kotlinx-html