Add ant target to install to maven, sample maven program.

This commit is contained in:
James Roseborough
2013-01-29 04:23:41 +00:00
parent 1626aad303
commit 9ffb9499e5
4 changed files with 84 additions and 1 deletions

View File

@@ -177,6 +177,17 @@
basedir="build" includes="luaj-${version}/**"/>
</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"/>
</project>

23
examples/maven/pom.xml Normal file
View 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>

View 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();
}
}

View 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]);
}
}