POM Operator is a library responsible for injecting dependencies into POM files programatically.
Use Maven:
$ git clone git@github.com:pixee/pom-operator.git && cd pom-operator
$ mvn clean install
There's a sample of usage from Java on the java-sample
directory - of look under the src/test
directory as well. TL;DR:
import org.junit.Test;
import io.github.pixee.maven.operator.ProjectModel;
import io.github.pixee.maven.operator.Dependency;
import io.github.pixee.maven.operator.POMOperator;
import io.github.pixee.maven.operator.ProjectModelFactory;
public class POMOperatorJavaTest {
@Test
public void testInterop() {
ProjectModel projectModel = ProjectModelFactory
.load(POMOperatorJavaTest.class.getResource("pom.xml"))
.withDependency(
new Dependency("org.dom4j", "dom4j", "0.0.0", null, "jar")
);
POMOperator.modify(projectModel);
}
}
It implements a Chain of Responsibility strategy - each Command
class attempts a different way of fixing a POM, based around a Context (in this case, a ProjectModel
)
e.g. to generate version 0.0.2
:
(mvn versions:set -DnewVersion=0.0.3 && git commit -am "Generating Tag" && git tag v0.0.3 && git push && git push --tags)
(export V='0.0.11-SNAPSHOT' ; mvn versions:set -DnewVersion=${V} && (cd java-sample ; mvn versions:set -DnewVersion=${V} && git commit -am "Generating development version" && git push))
Deploying:
mvn -N -B deploy -DaltDeploymentRepository=pixee-libs-release::default::https://pixee.jfrog.io/artifactory/default-maven-local
better readmebe able to guess existing indenting for existing documentsinvestigate leverage whats on versions-maven-plugin- consider fuzzying when testing