Add ant target to install to maven, sample maven program.
This commit is contained in:
11
build.xml
11
build.xml
@@ -177,6 +177,17 @@
|
|||||||
basedir="build" includes="luaj-${version}/**"/>
|
basedir="build" includes="luaj-${version}/**"/>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
<target name="mvn_install" depends="jar-jse">
|
||||||
|
<exec executable="mvn">
|
||||||
|
<arg value="install:install-file"/>
|
||||||
|
<arg value="-Dfile=${jar.name.jse}"/>
|
||||||
|
<arg value="-DgroupId=org.luaj"/>
|
||||||
|
<arg value="-DartifactId=luaj-jse"/>
|
||||||
|
<arg value="-Dversion=${version}"/>
|
||||||
|
<arg value="-Dpackaging=jar"/>
|
||||||
|
</exec>
|
||||||
|
</target>
|
||||||
|
|
||||||
<target name="all" depends="clean,jar-jme,jar-jse,jar-jse-sources"/>
|
<target name="all" depends="clean,jar-jme,jar-jse,jar-jse-sources"/>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
23
examples/maven/pom.xml
Normal file
23
examples/maven/pom.xml
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>acme</groupId>
|
||||||
|
<artifactId>maven-example</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<name>maven-example</name>
|
||||||
|
<url>http://maven.apache.org</url>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.luaj</groupId>
|
||||||
|
<artifactId>luaj-jse</artifactId>
|
||||||
|
<version>3.0-alpha3</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
||||||
25
examples/maven/src/main/java/acme/App.java
Normal file
25
examples/maven/src/main/java/acme/App.java
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
package acme;
|
||||||
|
|
||||||
|
import org.luaj.vm2.Globals;
|
||||||
|
import org.luaj.vm2.LuaValue;
|
||||||
|
import org.luaj.vm2.lib.jse.JsePlatform;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sample source file for a maven project that depends on luaj.
|
||||||
|
*/
|
||||||
|
public class App
|
||||||
|
{
|
||||||
|
public static void main( String[] args )
|
||||||
|
{
|
||||||
|
String script = "print 'hello, from luaj!'";
|
||||||
|
|
||||||
|
// create an environment to run in
|
||||||
|
Globals globals = JsePlatform.standardGlobals();
|
||||||
|
|
||||||
|
// Use the convenience function on the globals to load a chunk.
|
||||||
|
LuaValue chunk = globals.loadString(script, "maven-exmaple");
|
||||||
|
|
||||||
|
// Use any of the "call()" or "invoke()" functions directly on the chunk.
|
||||||
|
chunk.call();
|
||||||
|
}
|
||||||
|
}
|
||||||
24
examples/maven/src/test/java/acme/AppTest.java
Normal file
24
examples/maven/src/test/java/acme/AppTest.java
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
package acme;
|
||||||
|
|
||||||
|
import junit.framework.Test;
|
||||||
|
import junit.framework.TestCase;
|
||||||
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skeleton unit test for App, required for maven to be used to build the app.
|
||||||
|
*/
|
||||||
|
public class AppTest
|
||||||
|
extends TestCase
|
||||||
|
{
|
||||||
|
public AppTest( String testName ) {
|
||||||
|
super( testName );
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Test suite() {
|
||||||
|
return new TestSuite( AppTest.class );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testAppCanBeExecuted() {
|
||||||
|
App.main(new String[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user