adding ReadMe.md to describe maven usage, configuring exec:java plugin to execute the main 'namespace'
This commit is contained in:
@@ -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"
|
||||
@@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user