diff --git a/examples/maven/hello-world/pom.xml b/examples/maven/hello-world/pom.xml new file mode 100644 index 00000000000..ddc405f00d8 --- /dev/null +++ b/examples/maven/hello-world/pom.xml @@ -0,0 +1,108 @@ + + + + 4.0.0 + + org.jetbrains.kotlin.examples + hello-world + 1.0-SNAPSHOT + + + 1.0-SNAPSHOT + 4.10 + + + + + org.jetbrains.kotlin + kotlin-stdlib + ${kotlin.version} + + + + junit + junit + ${junit.version} + test + + + + + ${project.basedir}/src/main/kotlin + ${project.basedir}/src/test/kotlin + + + + kotlin-maven-plugin + org.jetbrains.kotlin + ${kotlin.version} + + + + + compile + compile + + compile + + + + test-compile + test-compile + + test-compile + + + + + + + + + + jetbrains-release + http://repository.jetbrains.com/releases + + true + + + false + + + + jetbrains-snapshots + http://repository.jetbrains.com/snapshots + + false + + + true + + + + + + + jetbrains-release + http://repository.jetbrains.com/releases + + true + + + false + + + + jetbrains-snapshots + http://repository.jetbrains.com/snapshots + + false + + + true + + + + diff --git a/examples/maven/hello-world/src/main/kotlin/Hello.kt b/examples/maven/hello-world/src/main/kotlin/Hello.kt new file mode 100644 index 00000000000..fc7d3e208c6 --- /dev/null +++ b/examples/maven/hello-world/src/main/kotlin/Hello.kt @@ -0,0 +1,10 @@ +package hello + +public fun getHelloString() : String { + return "Hello, world!" +} + +fun main(args : Array) { + println(getHelloString()) +} + diff --git a/examples/maven/hello-world/src/test/kotlin/HelloTest.kt b/examples/maven/hello-world/src/test/kotlin/HelloTest.kt new file mode 100644 index 00000000000..8fa98db15a9 --- /dev/null +++ b/examples/maven/hello-world/src/test/kotlin/HelloTest.kt @@ -0,0 +1,11 @@ +package hello.tests + +import junit.framework.TestCase +import kotlin.test.assertEquals +import hello.getHelloString + +class HelloTest : TestCase() { + fun testAssert() : Unit { + assertEquals("Hello, world!", getHelloString()) + } +} diff --git a/examples/maven/mixed-code-hello-world/pom.xml b/examples/maven/mixed-code-hello-world/pom.xml new file mode 100644 index 00000000000..14ba639fbba --- /dev/null +++ b/examples/maven/mixed-code-hello-world/pom.xml @@ -0,0 +1,105 @@ + + + + 4.0.0 + + org.jetbrains.kotlin.examples + mixed-code-hello-world + 1.0-SNAPSHOT + + + 1.0-SNAPSHOT + 4.10 + + + + + org.jetbrains.kotlin + kotlin-stdlib + ${kotlin.version} + + + + junit + junit + ${junit.version} + test + + + + + + + kotlin-maven-plugin + org.jetbrains.kotlin + ${kotlin.version} + + + + + compile + process-sources + + compile + + + + test-compile + process-test-sources + + test-compile + + + + + + + + + + jetbrains-release + http://repository.jetbrains.com/releases + + true + + + false + + + + jetbrains-snapshots + http://repository.jetbrains.com/snapshots + + false + + + true + + + + + + + jetbrains-release + http://repository.jetbrains.com/releases + + true + + + false + + + + jetbrains-snapshots + http://repository.jetbrains.com/snapshots + + false + + + true + + + + diff --git a/examples/maven/mixed-code-hello-world/src/main/java/hello/JavaHello.java b/examples/maven/mixed-code-hello-world/src/main/java/hello/JavaHello.java new file mode 100644 index 00000000000..69d31dd58f7 --- /dev/null +++ b/examples/maven/mixed-code-hello-world/src/main/java/hello/JavaHello.java @@ -0,0 +1,14 @@ +package hello; + +public class JavaHello { + public static String JavaHelloString = "Hello from Java!"; + + public static String getHelloStringFromKotlin() { + return namespace.KotlinHelloString; + } + + public static void main(String[] args) { + System.out.println(getHelloStringFromKotlin()); + System.out.println(namespace.getHelloStringFromJava()); + } +} diff --git a/examples/maven/mixed-code-hello-world/src/main/java/hello/KotlinHello.kt b/examples/maven/mixed-code-hello-world/src/main/java/hello/KotlinHello.kt new file mode 100644 index 00000000000..27a00b5ad1b --- /dev/null +++ b/examples/maven/mixed-code-hello-world/src/main/java/hello/KotlinHello.kt @@ -0,0 +1,7 @@ +package hello + +public val KotlinHelloString : String = "Hello from Kotlin!" + +public fun getHelloStringFromJava() : String { + return JavaHello.JavaHelloString.sure(); +} diff --git a/examples/maven/mixed-code-hello-world/src/test/java/hello/tests/HelloTest.java b/examples/maven/mixed-code-hello-world/src/test/java/hello/tests/HelloTest.java new file mode 100644 index 00000000000..9ac15d47763 --- /dev/null +++ b/examples/maven/mixed-code-hello-world/src/test/java/hello/tests/HelloTest.java @@ -0,0 +1,13 @@ +package hello.tests; + +import hello.JavaHello; +import junit.framework.TestCase; + +public class HelloTest extends TestCase { + public void testAssert() { + assertEquals("Hello from Kotlin!", JavaHello.getHelloStringFromKotlin()); + assertEquals("Hello from Java!", hello.namespace.getHelloStringFromJava()); + + System.out.println(hello.namespace.getHelloStringFromJava()); + } +}