
nl.praegus.fitnesse.symbols.MavenProjectVersions.DependencyInfo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of toolchain-fitnesse-plugin Show documentation
Show all versions of toolchain-fitnesse-plugin Show documentation
Auto-register autocomplete responder and add debug script table
package nl.praegus.fitnesse.symbols.MavenProjectVersions;
import org.apache.maven.model.Model;
import org.w3c.dom.Document;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.xpath.XPathExpression;
import javax.xml.xpath.XPathFactory;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
public class DependencyInfo {
private static final String HOMEPAGE_URL_XPATH = "/project/url";
private static final String LATEST_VERSION_XPATH = "/metadata/versioning/latest";
private final String groupId;
private final String artifactId;
private final String versionInPom;
private final String versionOnMvnCentral;
// Plugin
public DependencyInfo(String pluginGroup, String pluginArtifact) {
this.groupId = pluginGroup;
this.artifactId = pluginArtifact;
this.versionInPom = getClass().getPackage().getImplementationVersion();
this.versionOnMvnCentral = getLatestVersion(DocumentBuilderFactory.newInstance());
}
// Other Dependencies
public DependencyInfo(String groupId, String artifactId, String versionInPom, Model mavenModel) {
this.groupId = groupId;
this.artifactId = artifactId;
this.versionInPom = convertMavenVariableToVersion(versionInPom, mavenModel);
this.versionOnMvnCentral = getLatestVersion(DocumentBuilderFactory.newInstance());
}
// with factory for test
public DependencyInfo(String groupId, String artifactId, String versionInPom, Model mavenModel, DocumentBuilderFactory factory) {
this.groupId = groupId;
this.artifactId = artifactId;
this.versionInPom = convertMavenVariableToVersion(versionInPom, mavenModel);
this.versionOnMvnCentral = getLatestVersion(factory);
}
public String getArtifactId() {
return this.artifactId;
}
public String getVersionInPom() {
return this.versionInPom;
}
public String getVersionOnMvnCentral() {
return this.versionOnMvnCentral;
}
public List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy