diff --git a/README.html b/README.html
index 0588b866..1cba2d7b 100644
--- a/README.html
+++ b/README.html
@@ -725,6 +725,28 @@ See the Building and Testing
+
Maven integration
+The main jar files are now deployed in the maven central repository. To use them in your maven-based project, list them as a dependency:
+
+
+
+For JSE projects, add this dependency for the luaj-jse jar:
+
+ <dependency>
+ <groupId>org.luaj</groupId>
+ <artifactId>luaj-jse</artifactId>
+ <version>3.0-alpha3</version>
+ </dependency>
+
+while for JME projects, use the luaj-jme jar:
+
+ <dependency>
+ <groupId>org.luaj</groupId>
+ <artifactId>luaj-jme</artifactId>
+ <version>3.0-alpha3</version>
+ </dependency>
+
+
Building the jars
An ant file is included in the root directory which builds the libraries by default.
@@ -743,9 +765,9 @@ The main luaj JUnit tests are organized into a JUnit 3 suite:
Unit test scripts can be found in these locations
test/lua/*.lua
- test/junit/org/luaj/vm2/compiler/lua5.1-tests.zip
- test/junit/org/luaj/vm2/compiler/regressions.zip
- test/junit/org/luaj/vm2/vm1/luajvm1-tests.zip
+ test/lua/errors/*.lua
+ test/lua/perf/*.lua
+ test/lua/luaj3.0-tests.zip
Code coverage
@@ -769,11 +791,7 @@ Sources are hosted on SourceForge and available via sourceforge.net
SourceForge Luaj Download Area
-and LuaForge:
-
- LuaForge Luaj Project Page
- LuaForge Luaj Project Area
-
+Files are no longer hosted at LuaForge.
@@ -823,6 +841,7 @@ and LuaForge:
Fix bug 3597515 memory leak due to string caching by simplifying caching logic.
Fix bug 3565008 so that short substrings are backed by short arrays.
Fix bug 3495802 to return correct offset of substrings from string.find().
+Add artifacts to Maven central repository.
diff --git a/build-maven.xml b/build-maven.xml
new file mode 100644
index 00000000..6f24dded
--- /dev/null
+++ b/build-maven.xml
@@ -0,0 +1,148 @@
+
+
+
+
+
+
+
+
+
+
+ 4.0.0
+ org.luaj
+ luaj-]]>@{platform}
+ ]]>${version}
+ jar
+ luaj-]]>@{platform}
+ Luaj ]]>${version}@{platform}
+ http://sourceforge.net/projects/luaj/
+
+
+ MIT License
+ http://luaj.sourceforge.net/license.txt
+ repo
+
+
+
+
+ jrosebor
+ James Roseborough
+ jim.roseborough@luaj.org
+ -8
+
+
+
+ ifarmer
+ Ian Farmer
+ ian.farmer@luaj.org
+ -8
+
+
+
+
+ http://luaj.cvs.sourceforge.net/viewvc/luaj/luaj-vm/
+
+
+]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Luaj API]]>
+ Copyright © 2007-2013 Luaj.org. All Rights Reserved.]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Usage: ant -Dmajor=${major} -Dversion=${version} -f build-maven.xml [install | deploy]
+
+
diff --git a/examples/maven/src/main/java/acme/App.java b/examples/maven/src/main/java/acme/App.java
index a0b0deb5..347f99f3 100644
--- a/examples/maven/src/main/java/acme/App.java
+++ b/examples/maven/src/main/java/acme/App.java
@@ -11,7 +11,7 @@ public class App
{
public static void main( String[] args )
{
- String script = "print 'hello, from luaj!'";
+ String script = "print('hello, world', _VERSION)";
// create an environment to run in
Globals globals = JsePlatform.standardGlobals();
diff --git a/examples/maven/src/test/java/acme/AppTest.java b/examples/maven/src/test/java/acme/AppTest.java
index b5546043..d0827dbf 100644
--- a/examples/maven/src/test/java/acme/AppTest.java
+++ b/examples/maven/src/test/java/acme/AppTest.java
@@ -1,9 +1,19 @@
package acme;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+import javax.script.ScriptException;
+
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
+import org.luaj.vm2.Globals;
+import org.luaj.vm2.LuaValue;
+import org.luaj.vm2.lib.jse.JsePlatform;
+
+import acme.App;
+
/**
* Skeleton unit test for App, required for maven to be used to build the app.
*/
@@ -18,7 +28,22 @@ public class AppTest
return new TestSuite( AppTest.class );
}
- public void testAppCanBeExecuted() {
+ public void testMainProgramExecution() {
App.main(new String[0]);
}
+
+ public void testScriptEngineEvaluation() throws ScriptException {
+ ScriptEngineManager sem = new ScriptEngineManager();
+ ScriptEngine e = sem.getEngineByExtension(".lua");
+ String result = e.eval("return math.pi").toString().substring(0,8);
+ assertEquals("3.141592", result);
+ }
+
+ public void testDirectEvaluation() {
+ String script = "return math.pow(..., 3)";
+ Globals globals = JsePlatform.standardGlobals();
+ LuaValue chunk = globals.loadString(script, "cube");
+ int result = chunk.call(LuaValue.valueOf(5)).toint();
+ assertEquals(125, result);
+ }
}