adding ReadMe.md to describe maven usage, configuring exec:java plugin to execute the main 'namespace'

This commit is contained in:
lajos papp
2012-06-14 02:53:21 +02:00
parent 87871d0f91
commit 6c0a3024ca
2 changed files with 46 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
# Kotlin hello-world example with maven
## Prerequisites to running the example
* download Maven directly from the [Apache Maven homepage](http://maven.apache.org/download.html)
* install and configure your system as described in [the installation section](http://maven.apache.org/download.html#Installation)
## Compiling/Testing/Running the example
If you have maven on your path, simple type:
mvn test
It will compile:
* src/main/kotlin/Hello.kt into target/classes/hello/namespace.class
* src/main/kotlin/Hello.kt into target/test-classes/hello/tests/HelloTest.class
Then run tests, and finnaly run your man hello 'namespace'.
## Only running the example
Once you compiled the sources with previous 'mvn test' command, you can run the application by typing:
mvn exec:java
## Using commandline arguments
If you want to modify the main method in Hello.kt in order to use commandline arguments, you can specify them on commandline as:
mvn exec:java -Dexec.args="argument1"
+16
View File
@@ -59,6 +59,22 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>hello.namespace</mainClass>
</configuration>
</plugin>
</plugins>
</build>