pax_global_header 0000666 0000000 0000000 00000000064 12021740264 0014510 g ustar 00root root 0000000 0000000 52 comment=26e1b4bd9211b31dee26289a6d2725590f36c7dd
polyglot-maven-0.8~tobrien+git20120905/ 0000775 0000000 0000000 00000000000 12021740264 0017517 5 ustar 00root root 0000000 0000000 polyglot-maven-0.8~tobrien+git20120905/.gitignore 0000664 0000000 0000000 00000000115 12021740264 0021504 0 ustar 00root root 0000000 0000000 *.versionsBackup
*~
target/
.project
.classpath
.settings/
pmaven-*-SNAPSHOT
polyglot-maven-0.8~tobrien+git20120905/README.md 0000664 0000000 0000000 00000002707 12021740264 0021004 0 ustar 00root root 0000000 0000000 Description
-----------
Sonatype [Polyglot Maven](http://polyglot.sonatype.org/).
License
-------
[Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0.html)
Support
-------
To submit an issue, please use the [Sonatype Issue Tracker](https://issues.sonatype.org/browse/PMAVEN).
Building
--------
### Requirements
* [Maven](http://maven.apache.org) 2+
* [Java](http://java.sun.com/) 5+
Check-out and build:
git clone git://github.com/sonatype/polyglot-maven.git
cd polyglot-maven
mvn install
After this completes, you can unzip and play with polyglot maven:
unzip pmaven-cli/target/pmaven-*-bin.zip
./pmaven-*/bin/mvn
Polyglot maven includes a copy of maven 3.0.3, which isn't 100% backwards compatible
with maven 2.0. Specifically, some maven plugins might not work. Virtually all do however, so
it is feasible to move the unzipped directory and put that pmaven-*/bin on your path either
inplace of or before your existing mvn binary.
There is a translate command that will translate between different language's versions of pom.*
(and in the case of Clojure, read (not write) Leiningen's project.clj). It works by looking at
file extensions, so just give it a source and a destination file as arguments and it will translate
between them.
You don't normally have to use translate - the mvn command can read any format the translate command can,
either by reading any pom.* it can find or using a command line option e.g. mvn -f project.clj.
polyglot-maven-0.8~tobrien+git20120905/pmaven-atom/ 0000775 0000000 0000000 00000000000 12021740264 0021743 5 ustar 00root root 0000000 0000000 polyglot-maven-0.8~tobrien+git20120905/pmaven-atom/.gitignore 0000664 0000000 0000000 00000000104 12021740264 0023726 0 ustar 00root root 0000000 0000000 target/
.project
.classpath
.settings/
bin/
pmaven-*-SNAPSHOT
*.iml
polyglot-maven-0.8~tobrien+git20120905/pmaven-atom/pom.xml 0000664 0000000 0000000 00000002534 12021740264 0023264 0 ustar 00root root 0000000 0000000
4.0.0
org.sonatype.pmaven
pmaven
0.8-tobrien-SNAPSHOT
pmaven-atom
Polyglot Maven :: Atom
org.sonatype.pmaven
pmaven-common
polyglot-maven-0.8~tobrien+git20120905/pmaven-atom/src/ 0000775 0000000 0000000 00000000000 12021740264 0022532 5 ustar 00root root 0000000 0000000 polyglot-maven-0.8~tobrien+git20120905/pmaven-atom/src/main/ 0000775 0000000 0000000 00000000000 12021740264 0023456 5 ustar 00root root 0000000 0000000 polyglot-maven-0.8~tobrien+git20120905/pmaven-atom/src/main/java/ 0000775 0000000 0000000 00000000000 12021740264 0024377 5 ustar 00root root 0000000 0000000 polyglot-maven-0.8~tobrien+git20120905/pmaven-atom/src/main/java/org/ 0000775 0000000 0000000 00000000000 12021740264 0025166 5 ustar 00root root 0000000 0000000 polyglot-maven-0.8~tobrien+git20120905/pmaven-atom/src/main/java/org/sonatype/ 0000775 0000000 0000000 00000000000 12021740264 0027030 5 ustar 00root root 0000000 0000000 polyglot-maven-0.8~tobrien+git20120905/pmaven-atom/src/main/java/org/sonatype/maven/ 0000775 0000000 0000000 00000000000 12021740264 0030136 5 ustar 00root root 0000000 0000000 polyglot-maven-0.8~tobrien+git20120905/pmaven-atom/src/main/java/org/sonatype/maven/polyglot/ 0000775 0000000 0000000 00000000000 12021740264 0032007 5 ustar 00root root 0000000 0000000 polyglot-maven-0.8~tobrien+git20120905/pmaven-atom/src/main/java/org/sonatype/maven/polyglot/atom/ 0000775 0000000 0000000 00000000000 12021740264 0032747 5 ustar 00root root 0000000 0000000 AtomMapping.java 0000664 0000000 0000000 00000002267 12021740264 0035756 0 ustar 00root root 0000000 0000000 polyglot-maven-0.8~tobrien+git20120905/pmaven-atom/src/main/java/org/sonatype/maven/polyglot/atom /*
* Copyright (C) 2009 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sonatype.maven.polyglot.atom;
import org.codehaus.plexus.component.annotations.Component;
import org.sonatype.maven.polyglot.mapping.Mapping;
import org.sonatype.maven.polyglot.mapping.MappingSupport;
/**
* Atom compact grammar model mapping.
*
* @author dhanji@gmail.com (Dhanji R. Prasanna)
*/
@Component(role = Mapping.class, hint = "atom")
public class AtomMapping extends MappingSupport {
public AtomMapping() {
super("atom");
setPomNames("pom.atom");
setAcceptLocationExtensions(".atom");
setAcceptOptionKeys("atom:4.0.0");
setPriority(1);
}
} AtomModelReader.java 0000664 0000000 0000000 00000004460 12021740264 0036543 0 ustar 00root root 0000000 0000000 polyglot-maven-0.8~tobrien+git20120905/pmaven-atom/src/main/java/org/sonatype/maven/polyglot/atom /*
* Copyright (C) 2009 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sonatype.maven.polyglot.atom;
import org.apache.maven.model.Model;
import org.apache.maven.model.io.DefaultModelWriter;
import org.apache.maven.model.io.ModelReader;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.util.IOUtil;
import org.sonatype.maven.polyglot.atom.parsing.AtomParser;
import org.sonatype.maven.polyglot.atom.parsing.Project;
import org.sonatype.maven.polyglot.atom.parsing.Tokenizer;
import org.sonatype.maven.polyglot.execute.ExecuteManager;
import org.sonatype.maven.polyglot.io.ModelReaderSupport;
import java.io.IOException;
import java.io.Reader;
import java.io.StringWriter;
import java.util.Map;
/**
* Reads a pom.atom and transforms into a Maven {@link Model}.
*
* @author dhanji@gmail.com (Dhanji R. Prasanna)
*/
@Component(role = ModelReader.class, hint = "atom")
public class AtomModelReader extends ModelReaderSupport {
@Requirement
protected Logger log;
@Requirement
private ExecuteManager executeManager;
public Model read(final Reader input, final Map options) throws IOException {
assert input != null;
// Parse the token stream from our pom.atom configuration file.
Project project = new AtomParser(new Tokenizer(IOUtil.toString(input)).tokenize()).parse();
Model model = project.toMavenModel();
executeManager.install(model);
if (log.isDebugEnabled()) {
DefaultModelWriter writer = new DefaultModelWriter();
StringWriter buff = new StringWriter();
writer.write(buff, null, model);
log.debug("Read atom model: \n" + buff);
}
return model;
}
}
AtomModelWriter.java 0000664 0000000 0000000 00000005733 12021740264 0036621 0 ustar 00root root 0000000 0000000 polyglot-maven-0.8~tobrien+git20120905/pmaven-atom/src/main/java/org/sonatype/maven/polyglot/atom /*
* Copyright (C) 2009 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
// */
package org.sonatype.maven.polyglot.atom;
import org.apache.maven.model.Model;
import org.apache.maven.model.io.DefaultModelWriter;
import org.apache.maven.model.io.ModelWriter;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.logging.Logger;
import org.sonatype.maven.polyglot.io.ModelWriterSupport;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import java.io.IOException;
import java.io.StringReader;
import java.io.StringWriter;
import java.io.Writer;
import java.util.Map;
/**
* TODO fix!
*/
@Component(role=ModelWriter.class, hint="atom")
public class AtomModelWriter extends ModelWriterSupport {
@Requirement
protected Logger log;
public void write(final Writer output, final Map options, final Model model)
throws IOException {
assert output != null;
assert model != null;
StringWriter buff = new StringWriter();
DefaultModelWriter writer = new DefaultModelWriter();
writer.write(buff, options, model);
// Dom2Groovy converter = new Dom2Groovy(new IndentPrinter(new PrintWriter(output), " "));
try {
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document doc = builder.parse(new InputSource(new StringReader(buff.toString())));
Element root = doc.getDocumentElement();
NamedNodeMap attrs = root.getAttributes();
for (int i=0; i