@Override public List<ProductArtifact> getAdditionalPlugins(Product ctx) throws MojoExecutionException { ArrayList<ProductArtifact> additionalPlugins = new ArrayList<>(); // Add the embedded elasticsearch plugin if (new DefaultArtifactVersion(ctx.getVersion()).compareTo(FIRST_SEARCH_VERSION) >= 0) { // The version of search distribution should be the same as the search plugin. projectLoader.loadMavenProject(context.getExecutionEnvironment().getMavenSession(), context.getProject(), artifactFactory.createParentArtifact(SERVER_GROUP_ID, "bitbucket-parent", ctx.getVersion())) .flatMap(mavenProject -> Optional.ofNullable(mavenProject.getDependencyManagement()) .flatMap(dependencyManager -> dependencyManager.getDependencies().stream() .filter(dep -> dep.getGroupId().equals(SEARCH_GROUP_ID)) .findFirst() .flatMap(dependency -> Optional.ofNullable(dependency.getVersion())))) .ifPresent(version -> additionalPlugins.add(new ProductArtifact(SEARCH_GROUP_ID, "embedded-elasticsearch-plugin", version))); } return additionalPlugins; }
/** * Merges the properties: pom.xml overrides {@link AbstractProductHandlerMojo#setDefaultValues} overrides the Product Handler. * @param ctx the Product * @return the complete list of system properties */ protected final Map<String, String> mergeSystemProperties(Product ctx) { // Start from the base properties final Map<String, String> properties = new HashMap<>(getSystemProperties(ctx)); // Enter the System Property Variables from product context, overwriting duplicates ctx.getSystemPropertyVariables().forEach((key, value) -> properties.put(key, (String) value)); // Overwrite the default system properties with user input arguments Properties userProperties = context.getExecutionEnvironment().getMavenSession().getUserProperties(); userProperties.forEach((key, value) -> properties.put((String) key, (String) value)); return properties; }
Properties sysProps = execEnv.getMavenSession().getExecutionProperties(); sysProps.setProperty("groupId",props.getGroupId()); sysProps.setProperty("artifactId",props.getArtifactId());
Properties userProperties = execEnv.getMavenSession().getUserProperties(); userProperties.setProperty("groupId", props.getGroupId()); userProperties.setProperty("artifactId", props.getArtifactId());
MavenSession session = env.getMavenSession(); MavenProject currentProject = env.getMavenSession().getCurrentProject(); if ((plugin.getVersion() == null || plugin.getVersion().length() == 0) && currentProject != null) { PluginManagement pm = currentProject.getPluginManagement();
Properties sysProperties = execEnv.getMavenSession().getSystemProperties(); boolean skipThisMojo = sysProperties.containsKey("skipTests") || sysProperties.containsKey("skipITs") || List<String> goals = execEnv.getMavenSession().getGoals(); if (goals.contains("alfresco:run")) { sysProperties.put("skipTests", "true");
MavenSession session = env.getMavenSession(); MavenProject currentProject = env.getMavenSession().getCurrentProject(); if ((plugin.getVersion() == null || plugin.getVersion().length() == 0) && currentProject != null) { PluginManagement pm = currentProject.getPluginManagement();
if (StringUtils.isNotBlank(a.latest)) { getLog().info("using stable product version: " + a.latest); getMavenContext().getExecutionEnvironment().getMavenSession().getExecutionProperties().setProperty(pid + "Version", a.latest); getMavenContext().getExecutionEnvironment().getMavenSession().getExecutionProperties().setProperty(pid + "DataVersion", a.data); getMavenContext().getExecutionEnvironment().getMavenSession().getExecutionProperties().setProperty(pid + "Version", stableVersion); getMavenContext().getExecutionEnvironment().getMavenSession().getExecutionProperties().setProperty(pid + "DataVersion", stableDataVersion);
MavenSession session = env.getMavenSession();
try { pluginDescriptor = MavenCompatibilityHelper.loadPluginDescriptor(plugin, executionEnvironment, executionEnvironment.getMavenSession()); } catch (MojoExecutionException e) {
@Override protected void doExecute() throws MojoExecutionException, MojoFailureException { trackFirstRunIfNeeded(); getGoogleTracker().track(GoogleAmpsTracker.CREATE_PLUGIN); String pid = getProductId(); Product ctx = getProductContexts().get(pid); AbstractProductHandler handler = createProductHandler(pid); getLog().info("determining latest stable product version..."); String stableVersion = getStableProductVersion(handler,ctx); if (StringUtils.isNotBlank(stableVersion)) { getLog().info("using latest stable product version: " + stableVersion); getMavenContext().getExecutionEnvironment().getMavenSession().getExecutionProperties().setProperty(pid + "Version", stableVersion); } getLog().info("determining latest stable data version..."); String stableDataVersion = getStableDataVersion(handler,ctx); if (StringUtils.isNotBlank(stableDataVersion)) { getLog().info("using latest stable data version: " + stableDataVersion); getMavenContext().getExecutionEnvironment().getMavenSession().getExecutionProperties().setProperty(pid + "DataVersion", stableDataVersion); } getMavenGoals().createPlugin(getProductId(), ampsCreatePluginPrompter); }
private Artifact resolveArtifactForProduct(final ProductArtifact product) { final Artifact artifact = artifactFactory.createArtifact(product.getGroupId(), product.getArtifactId(), product.getVersion(), "compile", "obr"); try { final MavenSession session = context.getExecutionEnvironment().getMavenSession(); final MavenProject project = context.getExecutionEnvironment().getMavenProject(); final ArtifactResolver resolver = session.getContainer().lookup(ArtifactResolver.class); resolver.resolve(artifact, project.getRemoteArtifactRepositories(), session.getLocalRepository()); } catch (ArtifactNotFoundException | ArtifactResolutionException | ComponentLookupException e) { throw new RuntimeException(e); } return artifact; }