protected void mergeModel_Name( Model target, Model source, boolean sourceDominant, Map<Object, Object> context ) { String src = source.getName(); if ( src != null ) { if ( sourceDominant || target.getName() == null ) { target.setName( src ); target.setLocation( "name", source.getLocation( "name" ) ); } } }
@Override protected void mergeModel_Name( Model target, Model source, boolean sourceDominant, Map<Object, Object> context ) { String src = source.getName(); if ( src != null ) { if ( sourceDominant ) { target.setName( src ); target.setLocation( "name", source.getLocation( "name" ) ); } } }
ArrayList<Model> modelList = new ArrayList<>(); modelList.add(new Model("chandru")); modelList.add(new Model("mani")); modelList.add(new Model("vivek")); modelList.add(new Model("david")); Collections.sort(modelList, new Comparator<Model>() { @Override public int compare(Model lhs, Model rhs) { return lhs.getName().compareTo(rhs.getName()); } });
@Override public String getName() { return getModel().getName(); }
private void project(PrintWriter pw, Model model) { String name = model.getName(); if (name == null) { name = model.getArtifactId(); } String url = model.getUrl() == null ? "" : model.getUrl(); pw.print("project \"" + name + "\" @ \"" + url + "\""); packaging(pw, model); }
sPluginBundle.setName(model.getName());
@Override public SPluginBundle getPluginBundle() { SPluginBundle result = new SPluginBundle(); result.setName(model.getName()); result.setOrganization(model.getOrganization().getName()); return result; }
public SPluginBundle extractPluginBundleFromJar(Path jarFilePath) throws PluginException { String filename = jarFilePath.getFileName().toString(); PluginBundleVersionIdentifier pluginBundleVersionIdentifier = PluginBundleVersionIdentifier.fromFileName(filename); try (JarFile jarFile = new JarFile(jarFilePath.toFile())) { String pomLocation = "META-INF/maven/" + pluginBundleVersionIdentifier.getPluginBundleIdentifier().getGroupId() + "/" + pluginBundleVersionIdentifier.getPluginBundleIdentifier().getArtifactId() + "/" + "pom.xml"; ZipEntry pomEntry = jarFile.getEntry(pomLocation); if (pomEntry == null) { throw new PluginException("No pom.xml found in JAR file " + jarFilePath.toString() + ", " + pomLocation); } MavenXpp3Reader mavenreader = new MavenXpp3Reader(); Model model = mavenreader.read(jarFile.getInputStream(pomEntry)); SPluginBundle sPluginBundle = new SPluginBundle(); sPluginBundle.setOrganization(model.getOrganization().getName()); sPluginBundle.setName(model.getName()); return sPluginBundle; } catch (IOException e) { throw new PluginException(e); } catch (XmlPullParserException e) { throw new PluginException(e); } }
result.setName( src.getName() ); result.setOrganization( cloneOrganization( src.getOrganization() ) ); result.setPackaging( src.getPackaging() );
sPluginBundle.setName(model.getName());
sPluginBundleVersion.setName(model.getName()); sPluginBundleVersion.setType(SPluginBundleType.MAVEN); sPluginBundleVersion.setGroupId(groupId);
matchingPlugins++; sPluginBundleVersion.setName(mavenPluginVersion.getModel().getName()); sPluginBundleVersion.setOrganization(mavenPluginVersion.getModel().getOrganization().getName()); sPluginBundleVersion.setArtifactId(mavenPluginLocation.getArtifactId()); sPluginBundleVersion.setDescription(mavenPluginVersion.getModel().getDescription()); pluginBundle.setName(mavenPluginVersion.getModel().getName()); pluginBundle.setOrganization(mavenPluginVersion.getModel().getOrganization().getName()); if (pluginBundle.getLatestVersion() == null) {
sPluginBundle.setName(model.getName());
private SPluginBundleVersion createPluginBundleVersionFromMavenModel(Model model, boolean isLocalDev) { SPluginBundleVersion sPluginBundleVersion = new SPluginBundleVersion(); sPluginBundleVersion.setType(isLocalDev ? SPluginBundleType.LOCAL_DEV : SPluginBundleType.MAVEN); sPluginBundleVersion.setGroupId(model.getGroupId()); sPluginBundleVersion.setArtifactId(model.getArtifactId()); sPluginBundleVersion.setVersion(model.getVersion()); sPluginBundleVersion.setDescription(model.getDescription()); sPluginBundleVersion.setRepository("local"); sPluginBundleVersion.setMismatch(false); // TODO sPluginBundleVersion.setOrganization(model.getOrganization().getName()); sPluginBundleVersion.setName(model.getName()); return sPluginBundleVersion; }
@Override public SPluginBundleVersion getPluginBundleVersion() { SPluginBundleVersion sPluginBundleVersion = new SPluginBundleVersion(); sPluginBundleVersion.setType(SPluginBundleType.LOCAL); sPluginBundleVersion.setGroupId(model.getGroupId()); sPluginBundleVersion.setArtifactId(model.getArtifactId()); sPluginBundleVersion.setVersion(model.getVersion()); sPluginBundleVersion.setDescription(model.getDescription()); sPluginBundleVersion.setRepository("local"); sPluginBundleVersion.setMismatch(false); // TODO sPluginBundleVersion.setOrganization(model.getOrganization().getName()); sPluginBundleVersion.setName(model.getName()); return sPluginBundleVersion; } }
void project(Model model) { String name = model.getName(); if (name == null) { name = model.getArtifactId(); } p.printStartBlock( "project", name, model.getUrl() ); p.println(); p.println( "model_version", model.getModelVersion() ); p.println( "inception_year", model.getInceptionYear() ); id(model); parent(model.getParent()); p.println("packaging", model.getPackaging()); p.println(); description(model.getDescription()); developers( model.getDevelopers() ); issueManagement( model.getIssueManagement() ); mailingLists( model.getMailingLists() ); repositories( toRepositoryArray( model.getRepositories() ) ); pluginRepositories( toRepositoryArray( model.getPluginRepositories() ) ); sourceControl( model.getScm() ); distribution( model.getDistributionManagement() ); properties( model.getProperties() ); dependencies( model.getDependencies() ); modules( model.getModules() ); managements( model.getDependencyManagement(), model.getBuild() ); build( model.getBuild(), model.getBuild() ); profiles( model.getProfiles() ); reporting( model.getReporting() ); p.printEndBlock(); }