diff --git a/build.gradle b/build.gradle
index fb97f26..5ea1821 100755
--- a/build.gradle
+++ b/build.gradle
@@ -5,6 +5,7 @@ apply plugin: 'groovy'
apply plugin: 'maven'
apply plugin:'application'
apply plugin: 'signing'
+apply plugin: 'maven'
group 'com.software-ninja'
version version
@@ -174,6 +175,21 @@ apply plugin: 'release'
createReleaseTag.dependsOn uploadArchives
+//
+// Write a POM
+//
-
-
+task writeNewPom << {
+ pom {
+ project {
+ inceptionYear '2008'
+ licenses {
+ license {
+ name 'The Apache Software License, Version 2.0'
+ url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
+ distribution 'repo'
+ }
+ }
+ }
+ }.writeTo("$buildDir/newpom.xml")
+}
diff --git a/gradle.properties b/gradle.properties
index c31532a..c81021f 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,4 +1,4 @@
-version=2.1.1
+version=2.1.2-SNAPSHOT
profile=empty
ossrhUsername=m0smith
ossrhPassword=entered-during-uploadArchive-and-release
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 017cc7c..fc69dfe 100755
--- a/pom.xml
+++ b/pom.xml
@@ -1,313 +1,96 @@
-
-
- 4.0.0
-
- org.sonatype.oss
- oss-parent
- 7
-
- com.software-ninja
- malabar
- 2.0.0-SNAPSHOT
- malabar-mode-jar
- A Maven-enabled Java mode for Emacs
- 2009
- http://github.com/m0smith/malabar-mode-jar
-
- https://github.com/m0smith/malabar-mode-jar.git
- scm:git:git@github.com:m0smith/malabar-mode-jar.git
- scm:git:git@github.com:m0smith/malabar-mode-jar.git
- develop
-
-
- GitHub
- http://github.com/m0smith/malabar-mode-jar/issues
-
-
-
- The GNU General Public License, Version 2
- http://www.gnu.org/licenses/gpl2.txt
- repo
-
-
-
-
- User Support
- malabar.mode@librelist.com
-
- mailto:malabar.mode@librelist.com
-
-
- mailto:malabar.mode-unsubscribe@librelist.com
-
- http://librelist.com/browser/malabar.mode
-
-
-
-
- espenhw
- Espen Wiborg
- http://mailhide.recaptcha.net/d?k=01GFbnCG21M-KIunkjRjxWJw==&c=BsOjYVXpToqQKNHwMd0ZRx5XPNMia6agfhzc3Fwtink=
-
- Evil mastermind
-
-
-
- dstu
- Stu Black
-
- Keeper of the flame
-
-
-
- m0smith
- http://www.m0smith.com
- Matthew O. Smith
-
- Reanimator
-
- -7
-
-
-
-
-
- nflath
- http://github.com/nflath
-
-
- stepb
- http://github.com/stepb
-
-
- bbatsov
- http://github.com/bbatsov
-
-
- buzztaiki
- http://github.com/buzztaiki
-
-
- m0smith
- http://github.com/m0smith
-
-
-
-
- UTF-8
- 1.6
- 1.6
- 3.0.4
- 3.1
- 2.4
- 1.2.1
- 2.4.2
- 2.6
- 2.13
- 2.6
- 1.13.1
- 2.2
- 1.8
- 1.8.8
- 1.4
- 1.0
- 1.9
- 4.11
-
-
-
-
- org.apache.maven
- maven-embedder
- ${maven.version}
-
-
- org.apache.maven
- maven-aether-provider
- ${maven.version}
-
-
- org.apache.maven
- maven-compat
- ${maven.version}
-
-
- org.apache.maven
- maven-core
- ${maven.version}
-
-
-
- org.sonatype.aether
- aether-connector-wagon
- ${aether.version}
- runtime
-
-
-
- org.apache.maven.wagon
- wagon-provider-api
- ${wagon.version}
-
-
- org.apache.maven.wagon
- wagon-file
- ${wagon.version}
- runtime
-
-
- org.apache.maven.wagon
- wagon-http
- ${wagon.version}
- runtime
-
-
-
- org.codehaus.groovy
- groovy
- ${groovy.version}
-
-
- jline
- jline
- ${jline.version}
-
-
- org.fusesource.jansi
- jansi
- ${jansi.version}
-
-
-
- org.codehaus.gmaven.runtime
- gmaven-runtime-${groovy.major.version}
- ${gmaven.version}
- test
-
-
- junit
- junit
- ${junit.version}
-
-
- net.java.quickcheck
- quickcheck
- 0.6
- test
-
-
- com.jcabi
- jcabi-aether
- 0.1.10
-
-
-
-
-
- org.apache.maven.plugins
- maven-dependency-plugin
- 2.7
-
- compile
- ${user.home}/.malabar_mode/classpath
-
-
-
-
- org.codehaus.gmaven
- gmaven-plugin
- ${gmaven.version}
-
- ${groovy.major.version}
-
-
-
-
- generateStubs
- compile
- testCompile
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- ${maven.compiler.plugin.version}
-
- ${project.build.sourceEncoding}
-
- ${project.build.target.version}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-project-info-reports-plugin
- ${maven.project.info.reports.plugin.version}
-
-
-
- index
- summary
- dependencies
- scm
- license
- project-team
- issue-tracking
- plugins
-
-
-
-
- false
- false
-
-
-
- org.apache.maven.plugins
- maven-surefire-report-plugin
- ${maven.surefire.report.plugin.version}
-
-
-
-
-
-
- devel
-
-
-
- maven-dependency-plugin
- ${maven.dependency.plugin.version}
-
-
- devel-lib
- package
-
- copy-dependencies
-
-
- true
- ${project.build.directory}/lib
-
-
-
-
-
-
-
-
-
-
+
+
+ 4.0.0
+ com.software-ninja
+ malabar
+ 2.1.0-SNAPSHOT
+ 2008
+
+
+ The Apache Software License, Version 2.0
+ http://www.apache.org/licenses/LICENSE-2.0.txt
+ repo
+
+
+
+
+ org.apache.maven
+ maven-compat
+ 3.0.5
+ compile
+
+
+ jline
+ jline
+ 2.11
+ compile
+
+
+ com.jcabi
+ jcabi-aether
+ 0.10.1
+ compile
+
+
+ org.codehaus.groovy
+ groovy-all
+ 2.3.7
+ compile
+
+
+ org.apache.maven
+ maven-aether-provider
+ 3.0.5
+ compile
+
+
+ net.java.quickcheck
+ quickcheck
+ 0.6
+ test
+
+
+ org.apache.maven
+ maven-core
+ 3.0.5
+ compile
+
+
+ org.sonatype.aether
+ aether-connector-wagon
+ 1.13.1
+ compile
+
+
+ junit
+ junit
+ 4.11
+ compile
+
+
+ org.slf4j
+ slf4j-jdk14
+ 1.7.5
+ compile
+
+
+ org.apache.maven
+ maven-embedder
+ 3.0.5
+ compile
+
+
+ org.fusesource.jansi
+ jansi
+ 1.11
+ compile
+
+
+ org.apache.ivy
+ ivy
+ 2.3.0
+ compile
+
+
+
diff --git a/src/main/groovy/com/software_ninja/malabar/Malabar.groovy b/src/main/groovy/com/software_ninja/malabar/Malabar.groovy
index cdeff1d..624855d 100755
--- a/src/main/groovy/com/software_ninja/malabar/Malabar.groovy
+++ b/src/main/groovy/com/software_ninja/malabar/Malabar.groovy
@@ -4,12 +4,14 @@
package com.software_ninja.malabar;
import groovy.grape.Grape
+import groovy.util.logging.*
+
public static void main(String[] args) {
new MalabarStart('4429').startArgs(args);
}
-
+@Log
class MalabarStart {
private String defaultPort = '4428';
@@ -23,7 +25,7 @@ class MalabarStart {
def argMap = new SpreadMap(args);
String port = defaultPort;
if(argMap["-p"] != null) port = argMap["-p"];
- println "Starting with :" + argMap
+ log.fine "Starting with :" + argMap
startP(port);
}
diff --git a/src/main/groovy/com/software_ninja/malabar/MalabarUtil.groovy b/src/main/groovy/com/software_ninja/malabar/MalabarUtil.groovy
index d8835ea..e4330e1 100755
--- a/src/main/groovy/com/software_ninja/malabar/MalabarUtil.groovy
+++ b/src/main/groovy/com/software_ninja/malabar/MalabarUtil.groovy
@@ -1,5 +1,10 @@
+
package com.software_ninja.malabar;
+import java.util.logging.Logger;
+import java.util.logging.ConsoleHandler;
+import java.util.logging.Level;
+import java.util.logging.LogManager;
public class MalabarUtil {
@@ -13,6 +18,28 @@ public class MalabarUtil {
return f;
}
+
+ /**
+ * Set logging level.
+ */
+
+ public static setLevel(Class clazz, Level level){
+ setLevel(clazz.getName(), level);
+ }
+
+ public static setLevel(String logger, Level level){
+ setLevel(LogManager.logManager.getLogger(logger), level);
+ }
+
+ public static setLevel(Logger logger, Level level){
+ logger.setLevel(level);
+ logger.setUseParentHandlers(false);
+ ConsoleHandler handler = new ConsoleHandler();
+ handler.setLevel(level);
+ logger.addHandler(handler);
+ logger.handlers.each( { it.setLevel(level) });
+ }
+
}
diff --git a/src/main/groovy/com/software_ninja/malabar/http/MalabarServer.groovy b/src/main/groovy/com/software_ninja/malabar/http/MalabarServer.groovy
index 08cd5b7..e68319a 100755
--- a/src/main/groovy/com/software_ninja/malabar/http/MalabarServer.groovy
+++ b/src/main/groovy/com/software_ninja/malabar/http/MalabarServer.groovy
@@ -9,9 +9,10 @@ import com.sun.net.httpserver.Filter;
import com.sun.net.httpserver.Filter.Chain;
import groovy.util.logging.*
import java.util.logging.Handler
-import java.util.logging.Logger
+import java.util.logging.Logger
import java.util.logging.Level
import java.util.logging.LogManager
+import java.util.logging.ConsoleHandler;
@Log
class MalabarServer {
@@ -53,18 +54,23 @@ class MalabarServer {
context = httpServer.createContext('/tags/', new JsonHandlerFactory(config).build({params ->
def pmIn = params["pm"];
def pm = (pmIn == null ? null : MalabarUtil.expandFile(pmIn));
- mph.tags(params["repo"], pm, params["class"]);}));
+ mph.tags(params["repo"], pm, params["class"]);}));
context.getFilters().add(new ParameterFilter());
context = httpServer.createContext('/debug/', new JsonHandlerFactory(config).build({params ->
- def jmx = LogManager.getLoggingMXBean()
- jmx.loggerNames.each({ if( it.startsWith("com.software_ninja")) {
- jmx.setLoggerLevel( it, "FINEST")}});
+ def lm = LogManager.getLogManager();
+ lm.loggerNames.each( { if( it.startsWith("com.software_ninja")) {
+ def l = lm.getLogger(it);
+ MalabarUtil.setLevel(l, Level.FINEST);
+ }});
+
+
def pmIn = params["pm"];
def pm = (pmIn == null ? null : MalabarUtil.expandFile(pmIn));
mph.debug(params["repo"], pm)}));
+
context.getFilters().add(new ParameterFilter());
context = httpServer.createContext('/spawn/', new JsonHandlerFactory(config).build({params ->
diff --git a/src/main/groovy/com/software_ninja/malabar/lang/GroovyParser.groovy b/src/main/groovy/com/software_ninja/malabar/lang/GroovyParser.groovy
index b913ad3..3280695 100755
--- a/src/main/groovy/com/software_ninja/malabar/lang/GroovyParser.groovy
+++ b/src/main/groovy/com/software_ninja/malabar/lang/GroovyParser.groovy
@@ -2,7 +2,9 @@ package com.software_ninja.malabar.lang;
import org.codehaus.groovy.control.ErrorCollector;
import groovy.util.logging.*
+import java.util.logging.Level;
+@Log
public class GroovyParser implements Parser {
def classloader;
@@ -61,7 +63,7 @@ public class GroovyParser implements Parser {
return ["class": classloader.parseClass(code),
"errors" : []]
} catch (org.codehaus.groovy.control.MultipleCompilationErrorsException ex){
- ex.printStackTrace();
+ log.log(Level.FINEST, "Failed to parse file" + f.toString(), ex);
def rtnval = [];
ErrorCollector collector = ex.getErrorCollector();
["class" : null,
@@ -75,7 +77,7 @@ public class GroovyParser implements Parser {
return ["class": classloader.parseClass(s),
"errors" : []]
} catch (org.codehaus.groovy.control.MultipleCompilationErrorsException ex){
- ex.printStackTrace();
+ log.log(Level.FINEST, "Failed to parse string " + s, ex);
def rtnval = [];
ErrorCollector collector = ex.getErrorCollector();
["class" : null,
diff --git a/src/main/groovy/com/software_ninja/malabar/lang/JavaParser.groovy b/src/main/groovy/com/software_ninja/malabar/lang/JavaParser.groovy
index 818e482..9eb7a54 100755
--- a/src/main/groovy/com/software_ninja/malabar/lang/JavaParser.groovy
+++ b/src/main/groovy/com/software_ninja/malabar/lang/JavaParser.groovy
@@ -1,8 +1,8 @@
-
package com.software_ninja.malabar.lang;
import java.util.List;
import java.util.ArrayList;
+
import javax.tools.*;
import javax.tools.JavaCompiler.*;
@@ -11,6 +11,7 @@ import java.nio.CharBuffer;
import java.lang.reflect.Modifier;
import groovy.util.logging.*
+import java.util.logging.Level;
@Log
public class JavaParser implements Parser {
@@ -49,7 +50,13 @@ public class JavaParser implements Parser {
//String separator = System.getProperty("path.separator");
//String classpath = classloader.classPath.join(separator)
- def options = ["-g", "-verbose"];
+
+ def options = ["-g"];
+
+ if( log.isLoggable(Level.FINE) || log.isLoggable(Level.FINER) || log.isLoggable(Level.FINEST)) {
+ options = ["-g", "-verbose"];
+ }
+
StringWriter output = new StringWriter();
JavaCompiler.CompilationTask task = compiler.getTask(output, fileManager, listener,
@@ -65,7 +72,7 @@ public class JavaParser implements Parser {
def clazz = null;
if(clazzes.size > 0 ) {
clazz = clazzes[0];
- println "WHICH:" + fmClassloader.getResource("com/software_ninja/test/project/AppTest.class");
+
def publicClasses = clazzes.grep( { Modifier.isPublic(it.getModifiers())} );
if(publicClasses.size > 0) {
clazz = publicClasses[0];
diff --git a/src/main/groovy/com/software_ninja/malabar/project/MavenProjectHandler.groovy b/src/main/groovy/com/software_ninja/malabar/project/MavenProjectHandler.groovy
index 18e4060..5bb7dd1 100755
--- a/src/main/groovy/com/software_ninja/malabar/project/MavenProjectHandler.groovy
+++ b/src/main/groovy/com/software_ninja/malabar/project/MavenProjectHandler.groovy
@@ -67,6 +67,7 @@ import java.util.LinkedHashSet;
import java.util.List;
import java.util.Properties;
import java.util.Set;
+import java.util.logging.Level;
import groovy.util.logging.*
@Log
@@ -304,7 +305,7 @@ public class MavenProjectHandler {
}
Result result = new JUnitCore().run(request);
- println "UnitTest ... Complete:" + result.getFailureCount()
+ log.fine "UnitTest ... Complete:" + result.getFailureCount()
return result.getFailures().collect( { [ it.getTestHeader(),
it.getMessage(),
it.getException().getMessage(),
@@ -379,16 +380,22 @@ public class MavenProjectHandler {
//
def fecthProjectInfo = { repo, pom ->
+ def repox = (repo == null ? "~/.m2/repository" : repo);
+
try {
def x = new MavenProjectsCreator();
- def repox = (repo == null ? "~/.m2/repository" : repo);
def pjs = x.create(MalabarUtil.expandFile(repox), MalabarUtil.expandFile(pom))
return [runtime: x.resolveDependencies(pjs[0], repox, "runtime"),
systemProperties : System.getProperties(),
test: x.resolveDependencies(pjs[0], repox, "test")]
+
+
+
} catch (Exception ex) {
- throw new Exception( ex.getMessage() + " repo:" + repo + " pom:" + pom,
- ex);
+ ex.printStackTrace();
+ throw new Exception( ex.getMessage() + " repo:" +
+ MalabarUtil.expandFile(repox) +
+ " pom:" + MalabarUtil.expandFile(pom), ex);
}
}
@@ -398,7 +405,7 @@ public class MavenProjectHandler {
}
-
+@Log
public class MavenProjectsCreator {
public List create(String repo, String pom) {
Settings mavenSettings = new Settings();
@@ -414,6 +421,7 @@ public class MavenProjectsCreator {
throw new Exception(String.format("Unable to create Maven project model using POM %s.", pomFile), e);
}
}
+
private List createNow(Settings settings, File pomFile) throws PlexusContainerException, PlexusConfigurationException, ComponentLookupException, MavenExecutionRequestPopulationException, ProjectBuildingException {
//using jarjar for maven3 classes affects the contents of the effective pom
//references to certain Maven standard plugins contain jarjar in the fqn
@@ -458,9 +466,10 @@ public class MavenProjectsCreator {
}
- public Map resolveDependencies(project, repo, scope) {
+ public Map resolveDependencies(MavenProject project, repo, scope) {
File local = new File(repo);
+ Aether.class.getClassLoader().findResources("com/jcabi/aether/Aether.class").each({log.fine it.toString() });
Aether aether = new Aether(project, local);
List depLists = project.getDependencies().collect {
@@ -475,16 +484,27 @@ public class MavenProjectsCreator {
boolean rtnval = ! optional && ! (['activation', 'xerces-impl', 'ant',
'com.springsource.org.hibernate.validator-4.1.0.GA',
'xerces-impl-2.6.2'].contains(artifactId));
- //log.fine "" + rtnval + " NODE:" + optional + ' ' + artifactId + " " + parents;
+ log.fine "" + rtnval + " NODE:" + optional + ' ' + artifactId + " " + parents;
return rtnval;
}
}
-
- Collection deps = aether.resolve( art, scope , filter);
-
- deps.collect{ it.getFile().getAbsolutePath() }
+ try {
+
+
+
+
+ Collection deps = aether.resolve( art, scope , filter);
+
+ deps.collect{ it.getFile().getAbsolutePath() }
+ } catch ( org.sonatype.aether.resolution.DependencyResolutionException ex) {
+ log.log(Level.WARNING, ex.getResult().toString(), ex);
+ [];
+ } catch (Exception ex) {
+ log.log(Level.WARNING, ex.getMessage(), ex);
+ [];
+ }
}.grep({it.size() > 0})
diff --git a/src/test/groovy/com/software_ninja/malabar/lang/TestGroovyParser.groovy b/src/test/groovy/com/software_ninja/malabar/lang/TestGroovyParser.groovy
index 57d815e..0cbd4ce 100755
--- a/src/test/groovy/com/software_ninja/malabar/lang/TestGroovyParser.groovy
+++ b/src/test/groovy/com/software_ninja/malabar/lang/TestGroovyParser.groovy
@@ -1,9 +1,12 @@
package com.software_ninja.malabar.lang;
import org.junit.Test;
+import org.junit.Before;
import static org.junit.Assert.*;
-import com.software_ninja.malabar.lang.JavaParser;
+import java.util.logging.Level;
+
+import com.software_ninja.malabar.MalabarUtil;
import com.software_ninja.malabar.project.MavenProjectHandler;
public class TestGroovyParser {
@@ -18,6 +21,11 @@ public class TestGroovyParser {
def groovyParser = cacheEntry['parsers']['groovy'];
+
+ @Before
+ public void before() {
+ MalabarUtil.setLevel( "com.software_ninja.malabar.lang.GroovyParser", Level.FINEST);
+ }
@Test
public void testFileParser() throws Exception {
diff --git a/src/test/groovy/com/software_ninja/malabar/lang/TestJavaParser.groovy b/src/test/groovy/com/software_ninja/malabar/lang/TestJavaParser.groovy
index 28ad735..cd09c3c 100755
--- a/src/test/groovy/com/software_ninja/malabar/lang/TestJavaParser.groovy
+++ b/src/test/groovy/com/software_ninja/malabar/lang/TestJavaParser.groovy
@@ -1,10 +1,14 @@
+
package com.software_ninja.malabar.lang;
import org.junit.Test;
+import org.junit.Before;
import static org.junit.Assert.*;
-import com.software_ninja.malabar.lang.JavaParser;
+import com.software_ninja.malabar.MalabarUtil;
import com.software_ninja.malabar.project.MavenProjectHandler;
+
+import java.util.logging.Level;
public class TestJavaParser {
@@ -20,6 +24,11 @@ public class TestJavaParser {
def javaParser = cacheEntry['parsers']['java'];
+ @Before
+ public void before() {
+ MalabarUtil.setLevel( "com.software_ninja.malabar.lang.JavaParser", Level.FINEST);
+ }
+
@Test
public void testFileParser() throws Exception {
diff --git a/src/test/groovy/com/software_ninja/malabar/project/TestMavenProjectHandler.groovy b/src/test/groovy/com/software_ninja/malabar/project/TestMavenProjectHandler.groovy
index 47ff81f..43567af 100755
--- a/src/test/groovy/com/software_ninja/malabar/project/TestMavenProjectHandler.groovy
+++ b/src/test/groovy/com/software_ninja/malabar/project/TestMavenProjectHandler.groovy
@@ -95,8 +95,9 @@ class MavenProjectTester {
* Properties:
* # Not throw an exception
* # Returns a map
- * # the map has a runtime key
- * # the map has a test key
+ * # the projectInfo has a runtime key
+ * # the projectInfo has a test key
+ * # the cacheEntry has a timestamp
**/
@Test
void testMavenImport() {
@@ -105,13 +106,18 @@ class MavenProjectTester {
pomGenerator("src/test/resources/pom/",~/.*\.pom/ )))) {
File pom = pair.getSecond();
println "processing " + pom;
- Map map = new MavenProjectHandler(config).projectInfo(pair.getFirst(),
+ MavenProjectHandler mph = new MavenProjectHandler(config);
+ Map cacheEntry = mph.lookInCache(pom, { mph.fecthProjectInfo(pair.getFirst(), pom.absolutePath )} )
+ Map projectInfo = mph.projectInfo(pair.getFirst(),
pom.absolutePath);
- assertNotNull( map['test']);
- assertNotNull( map['runtime']);
- assertNotNull( map['systemProperties']);
-
- assertTrue( map['test']['classpath'].size() >= 0);
+ println "CacheEntry: " + cacheEntry;
+ projectInfo.each { k,v -> println " KEY:" + k; }
+ assertNotNull( projectInfo['test']);
+ assertNotNull( projectInfo['runtime']);
+ assertNotNull( projectInfo['systemProperties']);
+ assertNotNull( cacheEntry['timestamp']);
+
+ assertTrue( projectInfo['test']['classpath'].size() >= 0);
}
}