List of usage examples for org.apache.maven.project MavenProject setPackaging
public void setPackaging(String packaging)
From source file:de.eacg.ecs.plugin.ProjectFix.java
public static void fixProject(MavenProject model) { Artifact a = model.getArtifact();/* www . ja v a 2 s . com*/ String str = String.format("%s:%s:%s:%s:%s", a.getGroupId(), a.getArtifactId(), a.getType(), a.hasClassifier() ? a.getClassifier() : "", a.getVersion()); String fixed = lookup.get(str); if (fixed != null) { String[] parts = fixed.split(":"); if (parts.length == 5) { model.setGroupId(parts[0]); model.setArtifactId(parts[1]); model.setPackaging(parts[2]); model.setVersion(parts[4]); model.setArtifact(new DefaultArtifact(parts[0], parts[1], parts[4], model.getArtifact().getScope(), parts[2], parts[3].isEmpty() ? null : parts[3], model.getArtifact().getArtifactHandler())); } } }
From source file:io.sundr.maven.GenerateBomMojo.java
License:Apache License
/** * Returns the model of the {@link org.apache.maven.project.MavenProject} to generate. * This is a trimmed down version and contains just the stuff that need to go into the bom. * * @param project The source {@link org.apache.maven.project.MavenProject}. * @param config The {@link io.sundr.maven.BomConfig}. * @return The build {@link org.apache.maven.project.MavenProject}. */// ww w . j a v a2s. co m private static MavenProject toGenerate(MavenProject project, BomConfig config, Collection<Dependency> dependencies, Set<Artifact> plugins) { MavenProject toGenerate = project.clone(); toGenerate.setGroupId(project.getGroupId()); toGenerate.setArtifactId(config.getArtifactId()); toGenerate.setVersion(project.getVersion()); toGenerate.setPackaging("pom"); toGenerate.setName(config.getName()); toGenerate.setDescription(config.getDescription()); toGenerate.setUrl(project.getUrl()); toGenerate.setLicenses(project.getLicenses()); toGenerate.setScm(project.getScm()); toGenerate.setDevelopers(project.getDevelopers()); toGenerate.getModel().setDependencyManagement(new DependencyManagement()); for (Dependency dependency : dependencies) { toGenerate.getDependencyManagement().addDependency(dependency); } toGenerate.getModel().setBuild(new Build()); if (!plugins.isEmpty()) { toGenerate.getModel().setBuild(new Build()); toGenerate.getModel().getBuild().setPluginManagement(new PluginManagement()); for (Artifact artifact : plugins) { toGenerate.getPluginManagement().addPlugin(toPlugin(artifact)); } } return toGenerate; }
From source file:io.sundr.maven.GenerateBomMojo.java
License:Apache License
/** * Returns the generated {@link org.apache.maven.project.MavenProject} to build. * This version of the project contains all the stuff needed for building (parents, profiles, properties etc). * * @param project The source {@link org.apache.maven.project.MavenProject}. * @param config The {@link io.sundr.maven.BomConfig}. * @return The build {@link org.apache.maven.project.MavenProject}. *//*www . j a va 2s. com*/ private static MavenProject toBuild(MavenProject project, BomConfig config) { File outputDir = new File(project.getBuild().getOutputDirectory()); File bomDir = new File(outputDir, config.getArtifactId()); File generatedBom = new File(bomDir, BOM_NAME); MavenProject toBuild = project.clone(); //we want to avoid recursive "generate-bom". toBuild.setExecutionRoot(false); toBuild.setFile(generatedBom); toBuild.getModel().setPomFile(generatedBom); toBuild.setModelVersion(project.getModelVersion()); toBuild.setArtifact(new DefaultArtifact(project.getGroupId(), config.getArtifactId(), project.getVersion(), project.getArtifact().getScope(), project.getArtifact().getType(), project.getArtifact().getClassifier(), project.getArtifact().getArtifactHandler())); toBuild.setParent(project.getParent()); toBuild.getModel().setParent(project.getModel().getParent()); toBuild.setGroupId(project.getGroupId()); toBuild.setArtifactId(config.getArtifactId()); toBuild.setVersion(project.getVersion()); toBuild.setPackaging("pom"); toBuild.setName(config.getName()); toBuild.setDescription(config.getDescription()); toBuild.setUrl(project.getUrl()); toBuild.setLicenses(project.getLicenses()); toBuild.setScm(project.getScm()); toBuild.setDevelopers(project.getDevelopers()); toBuild.setDistributionManagement(project.getDistributionManagement()); toBuild.getModel().setProfiles(project.getModel().getProfiles()); //We want to avoid having the generated stuff wiped. toBuild.getProperties().put("clean.skip", "true"); toBuild.getModel().getBuild().setDirectory(bomDir.getAbsolutePath()); toBuild.getModel().getBuild().setOutputDirectory(new File(bomDir, "target").getAbsolutePath()); for (String key : config.getProperties().stringPropertyNames()) { toBuild.getProperties().put(key, config.getProperties().getProperty(key)); } return toBuild; }
From source file:org.codehaus.griffon.maven.plugin.tools.DefaultGriffonServices.java
License:Apache License
public MavenProject createPOM(String groupId, GriffonProject griffonProjectDescriptor, String mtgGroupId, String griffonPluginArtifactId, String mtgVersion, boolean addEclipseSettings) { MavenProject pom = new MavenProject(); if (pom.getBuild().getPluginManagement() == null) { pom.getBuild().setPluginManagement(new PluginManagement()); }/*from www. jav a2 s.c om*/ PluginManagement pluginMgt = pom.getPluginManagement(); // Those four properties are needed. pom.setModelVersion("4.0.0"); pom.setPackaging("griffon-app"); // Specific for GRAILS pom.getModel().getProperties().setProperty("griffonHome", "${env.GRIFFON_HOME}"); pom.getModel().getProperties().setProperty("griffonVersion", griffonProjectDescriptor.getAppGriffonVersion()); // Add our own plugin Plugin griffonPlugin = new Plugin(); griffonPlugin.setGroupId(mtgGroupId); griffonPlugin.setArtifactId(griffonPluginArtifactId); griffonPlugin.setVersion(mtgVersion); griffonPlugin.setExtensions(true); pom.addPlugin(griffonPlugin); // Add compiler plugin settings Plugin compilerPlugin = new Plugin(); compilerPlugin.setGroupId("org.apache.maven.plugins"); compilerPlugin.setArtifactId("maven-compiler-plugin"); Xpp3Dom compilerConfig = new Xpp3Dom("configuration"); Xpp3Dom source = new Xpp3Dom("source"); source.setValue("1.5"); compilerConfig.addChild(source); Xpp3Dom target = new Xpp3Dom("target"); target.setValue("1.5"); compilerConfig.addChild(target); compilerPlugin.setConfiguration(compilerConfig); pom.addPlugin(compilerPlugin); // Add eclipse plugin settings if (addEclipseSettings) { Plugin eclipsePlugin = new Plugin(); eclipsePlugin.setGroupId("org.apache.maven.plugins"); eclipsePlugin.setArtifactId("maven-eclipse-plugin"); Xpp3Dom configuration = new Xpp3Dom("configuration"); Xpp3Dom projectnatures = new Xpp3Dom("additionalProjectnatures"); Xpp3Dom projectnature = new Xpp3Dom("projectnature"); projectnature.setValue("org.codehaus.groovy.eclipse.groovyNature"); projectnatures.addChild(projectnature); configuration.addChild(projectnatures); Xpp3Dom additionalBuildcommands = new Xpp3Dom("additionalBuildcommands"); Xpp3Dom buildcommand = new Xpp3Dom("buildcommand"); buildcommand.setValue("org.codehaus.groovy.eclipse.groovyBuilder"); additionalBuildcommands.addChild(buildcommand); configuration.addChild(additionalBuildcommands); Xpp3Dom packaging = new Xpp3Dom("packaging"); packaging.setValue("zip"); configuration.addChild(packaging); eclipsePlugin.setConfiguration(configuration); pluginMgt.addPlugin(eclipsePlugin); } // Change the default output directory to generate classes pom.getModel().getBuild().setOutputDirectory("web-app/WEB-INF/classes"); pom.setArtifactId(griffonProjectDescriptor.getAppName()); pom.setName(griffonProjectDescriptor.getAppName()); pom.setGroupId(groupId); pom.setVersion(griffonProjectDescriptor.getAppVersion()); if (!griffonProjectDescriptor.getAppVersion().endsWith("SNAPSHOT")) { getLogger().warn("====================================================================="); getLogger().warn("If your project is currently in development, in accordance with maven "); getLogger().warn("standards, its version must be " + griffonProjectDescriptor.getAppVersion() + "-SNAPSHOT and not " + griffonProjectDescriptor.getAppVersion() + "."); getLogger().warn("Please, change your version in the application.properties descriptor"); getLogger().warn("and regenerate your pom."); getLogger().warn("====================================================================="); } return pom; }
From source file:org.grails.maven.plugin.tools.DefaultGrailsServices.java
License:Apache License
public MavenProject createPOM(final String groupId, final GrailsProject grailsProjectDescriptor, final String mtgGroupId, final String grailsPluginArtifactId, final String mtgVersion, final boolean addEclipseSettings) { final MavenProject pom = new MavenProject(); if (pom.getBuild().getPluginManagement() == null) { pom.getBuild().setPluginManagement(new PluginManagement()); }/*w w w. j a v a2 s. co m*/ final PluginManagement pluginMgt = pom.getPluginManagement(); // Those four properties are needed. pom.setModelVersion("4.0.0"); pom.setPackaging("grails-app"); // Specific for GRAILS pom.getModel().getProperties().setProperty("grailsHome", "${env.GRAILS_HOME}"); pom.getModel().getProperties().setProperty("grailsVersion", grailsProjectDescriptor.getAppGrailsVersion()); // Add our own plugin final Plugin grailsPlugin = new Plugin(); grailsPlugin.setGroupId(mtgGroupId); grailsPlugin.setArtifactId(grailsPluginArtifactId); grailsPlugin.setVersion(mtgVersion); grailsPlugin.setExtensions(true); pom.addPlugin(grailsPlugin); // Add compiler plugin settings final Plugin compilerPlugin = new Plugin(); compilerPlugin.setGroupId("org.apache.maven.plugins"); compilerPlugin.setArtifactId("maven-compiler-plugin"); final Xpp3Dom compilerConfig = new Xpp3Dom("configuration"); final Xpp3Dom source = new Xpp3Dom("source"); source.setValue("1.5"); compilerConfig.addChild(source); final Xpp3Dom target = new Xpp3Dom("target"); target.setValue("1.5"); compilerConfig.addChild(target); compilerPlugin.setConfiguration(compilerConfig); pom.addPlugin(compilerPlugin); // Add eclipse plugin settings if (addEclipseSettings) { final Plugin warPlugin = new Plugin(); warPlugin.setGroupId("org.apache.maven.plugins"); warPlugin.setArtifactId("maven-war-plugin"); final Xpp3Dom warConfig = new Xpp3Dom("configuration"); final Xpp3Dom warSourceDirectory = new Xpp3Dom("warSourceDirectory"); warSourceDirectory.setValue("web-app"); warConfig.addChild(warSourceDirectory); warPlugin.setConfiguration(warConfig); pluginMgt.addPlugin(warPlugin); final Plugin eclipsePlugin = new Plugin(); eclipsePlugin.setGroupId("org.apache.maven.plugins"); eclipsePlugin.setArtifactId("maven-eclipse-plugin"); final Xpp3Dom configuration = new Xpp3Dom("configuration"); final Xpp3Dom projectnatures = new Xpp3Dom("additionalProjectnatures"); final Xpp3Dom projectnature = new Xpp3Dom("projectnature"); projectnature.setValue("org.codehaus.groovy.eclipse.groovyNature"); projectnatures.addChild(projectnature); configuration.addChild(projectnatures); final Xpp3Dom additionalBuildcommands = new Xpp3Dom("additionalBuildcommands"); final Xpp3Dom buildcommand = new Xpp3Dom("buildcommand"); buildcommand.setValue("org.codehaus.groovy.eclipse.groovyBuilder"); additionalBuildcommands.addChild(buildcommand); configuration.addChild(additionalBuildcommands); // Xpp3Dom additionalProjectFacets = new Xpp3Dom( // "additionalProjectFacets"); // Xpp3Dom jstWeb = new Xpp3Dom("jst.web"); // jstWeb.setValue("2.5"); // additionalProjectFacets.addChild(jstWeb); // configuration.addChild(additionalProjectFacets); final Xpp3Dom packaging = new Xpp3Dom("packaging"); packaging.setValue("war"); configuration.addChild(packaging); eclipsePlugin.setConfiguration(configuration); pluginMgt.addPlugin(eclipsePlugin); } // Change the default output directory to generate classes pom.getModel().getBuild().setOutputDirectory("web-app/WEB-INF/classes"); pom.setArtifactId(grailsProjectDescriptor.getAppName()); pom.setName(grailsProjectDescriptor.getAppName()); pom.setGroupId(groupId); pom.setVersion(grailsProjectDescriptor.getAppVersion()); if (!grailsProjectDescriptor.getAppVersion().endsWith("SNAPSHOT")) { getLogger().warn("====================================================================="); getLogger().warn("If your project is currently in development, in accordance with maven "); getLogger().warn("standards, its version must be " + grailsProjectDescriptor.getAppVersion() + "-SNAPSHOT and not " + grailsProjectDescriptor.getAppVersion() + "."); getLogger().warn("Please, change your version in the application.properties descriptor"); getLogger().warn("and regenerate your pom."); getLogger().warn("====================================================================="); } return pom; }
From source file:org.ops4j.pax.construct.lifecycle.ProvisionMojo.java
License:Apache License
/** * Create new POM (based on the root POM) which lists the deployed bundles as dependencies * // w ww . j a v a 2 s. c o m * @param bundles list of bundles to be deployed * @return deployment project * @throws MojoExecutionException */ private MavenProject createDeploymentProject(List bundles) throws MojoExecutionException { MavenProject deployProject; if (null == m_project.getFile()) { deployProject = new MavenProject(); deployProject.setGroupId("examples"); deployProject.setArtifactId("pax-provision"); deployProject.setVersion("1.0-SNAPSHOT"); } else { deployProject = new MavenProject(m_project); } String internalId = PomUtils.getCompoundId(deployProject.getGroupId(), deployProject.getArtifactId()); deployProject.setGroupId(internalId + ".build"); deployProject.setArtifactId("deployment"); // remove unnecessary cruft deployProject.setPackaging("pom"); deployProject.getModel().setModules(null); deployProject.getModel().setDependencies(bundles); deployProject.getModel().setPluginRepositories(null); deployProject.getModel().setReporting(null); deployProject.setBuild(null); File deployFile = new File(deployProject.getBasedir(), "runner/deploy-pom.xml"); deployFile.getParentFile().mkdirs(); deployProject.setFile(deployFile); try { Writer writer = StreamFactory.newXmlWriter(deployFile); deployProject.writeModel(writer); IOUtil.close(writer); } catch (IOException e) { throw new MojoExecutionException("Unable to write deployment POM " + deployFile); } return deployProject; }
From source file:org.ops4j.pax.construct.project.ImportBundleMojo.java
License:Apache License
/** * Resolve the Maven project for the given artifact, handling when a POM cannot be found in the repository * //from w w w .j a v a 2s . c om * @param pomGroupId project group id * @param pomArtifactId project artifact id * @param pomVersion project version * @return resolved Maven project */ private MavenProject buildMavenProject(String pomGroupId, String pomArtifactId, String pomVersion) { Artifact pomArtifact = m_factory.createProjectArtifact(pomGroupId, pomArtifactId, pomVersion); MavenProject project; try { project = m_projectBuilder.buildFromRepository(pomArtifact, m_remoteRepos, m_localRepo); } catch (ProjectBuildingException e) { getLog().warn("Problem resolving project " + pomArtifact.getId()); return null; } /* * look to see if this is a local project (if so then set the POM location) */ Pom localPom = DirUtils.findPom(targetDirectory, pomGroupId + ':' + pomArtifactId); if (localPom != null) { project.setFile(localPom.getFile()); } /* * Repair stubs (ie. when a POM couldn't be found in the various repositories) */ DistributionManagement dm = project.getDistributionManagement(); if (dm != null && "generated".equals(dm.getStatus())) { if (localPom != null) { // local project, use values from the local POM project.setPackaging(localPom.getPackaging()); project.setName(localPom.getId()); } else { // remote project - assume it creates a jarfile (so we can test later for OSGi metadata) Artifact jar = m_factory.createBuildArtifact(pomGroupId, pomArtifactId, pomVersion, "jar"); project.setArtifact(jar); project.setPackaging("jar"); project.setName(jar.getId()); } } return project; }
From source file:org.sourcepit.common.maven.core.MavenProjectUtils.java
License:Apache License
public static org.sourcepit.common.maven.model.MavenProject toMavenProject( @NotNull org.apache.maven.project.MavenProject mavenProject) { final org.sourcepit.common.maven.model.MavenProject mProject = MavenModelFactory.eINSTANCE .createMavenProject();//from w w w . ja v a 2 s.c o m mProject.setGroupId(mavenProject.getGroupId()); mProject.setArtifactId(mavenProject.getArtifactId()); mProject.setVersion(mavenProject.getVersion()); if (mavenProject.getPackaging() != null && !ObjectUtils.equals(mProject.getPackaging(), mavenProject.getPackaging())) { mProject.setPackaging(mavenProject.getPackaging()); } mProject.setPomFile(mavenProject.getFile()); mProject.setOutputDirectory(MavenProjectUtils.getOutputDir(mavenProject)); mProject.setTestOutputDirectory(MavenProjectUtils.getTestOutputDir(mavenProject)); return mProject; }
From source file:org.sourcepit.tpmp.resolver.tycho.TychoSessionTargetPlatformResolver.java
License:Apache License
private MavenProject setupAggregatedProject(MavenSession session, TargetPlatformConfiguration aggregatedConfiguration) { PropertiesMap mvnProperties = new LinkedPropertiesMap(); mvnProperties.load(getClass().getClassLoader(), "META-INF/tpmp/maven.properties"); String groupId = mvnProperties.get("groupId"); String artifactId = mvnProperties.get("artifactId"); String version = mvnProperties.get("version"); final String tpmpKey = Plugin.constructKey(groupId, artifactId); MavenProject origin = session.getCurrentProject(); Model model = origin.getModel().clone(); Build build = model.getBuild();//from ww w.jav a 2 s.c om if (build.getPluginsAsMap().get(tpmpKey) == null) { Plugin tpmp = new Plugin(); tpmp.setGroupId(groupId); tpmp.setArtifactId(artifactId); tpmp.setVersion(version); build.getPlugins().add(tpmp); build.flushPluginMap(); } MavenProject fake = new MavenProject(model); fake.setClassRealm(origin.getClassRealm()); fake.setFile(origin.getFile()); final Map<String, ArtifactRepository> artifactRepositories = new LinkedHashMap<String, ArtifactRepository>(); final Map<String, ArtifactRepository> pluginRepositories = new LinkedHashMap<String, ArtifactRepository>(); for (MavenProject project : session.getProjects()) { for (ArtifactRepository repository : project.getRemoteArtifactRepositories()) { if (!artifactRepositories.containsKey(repository.getId())) { artifactRepositories.put(repository.getId(), repository); } } for (ArtifactRepository repository : project.getPluginArtifactRepositories()) { if (!pluginRepositories.containsKey(repository.getId())) { pluginRepositories.put(repository.getId(), repository); } } } fake.setRemoteArtifactRepositories(new ArrayList<ArtifactRepository>(artifactRepositories.values())); fake.setPluginArtifactRepositories(new ArrayList<ArtifactRepository>(pluginRepositories.values())); fake.setManagedVersionMap(origin.getManagedVersionMap()); if (getTychoProject(fake) == null) { fake.setPackaging("eclipse-repository"); } fake.getBuildPlugins(); AbstractTychoProject tychoProject = (AbstractTychoProject) getTychoProject(fake); tychoProject.setupProject(session, fake); Properties properties = new Properties(); properties.putAll(fake.getProperties()); properties.putAll(session.getSystemProperties()); // session wins properties.putAll(session.getUserProperties()); fake.setContextValue(TychoConstants.CTX_MERGED_PROPERTIES, properties); fake.setContextValue(TychoConstants.CTX_TARGET_PLATFORM_CONFIGURATION, aggregatedConfiguration); ExecutionEnvironmentConfiguration eeConfiguration = new ExecutionEnvironmentConfigurationImpl(logger, aggregatedConfiguration.isResolveWithEEConstraints()); tychoProject.readExecutionEnvironmentConfiguration(fake, eeConfiguration); fake.setContextValue(TychoConstants.CTX_EXECUTION_ENVIRONMENT_CONFIGURATION, eeConfiguration); final DependencyMetadata dm = new DependencyMetadata(); for (ReactorProject reactorProject : DefaultReactorProject.adapt(session)) { mergeMetadata(dm, reactorProject, true); mergeMetadata(dm, reactorProject, false); } int i = 0; for (Object object : dm.getMetadata(true)) { InstallableUnitDAO dao = new TychoSourceIUResolver.InstallableUnitDAO( object.getClass().getClassLoader()); dao.setProperty(object, RepositoryLayoutHelper.PROP_CLASSIFIER, "fake_" + i); i++; } for (Object object : dm.getMetadata(false)) { InstallableUnitDAO dao = new TychoSourceIUResolver.InstallableUnitDAO( object.getClass().getClassLoader()); dao.setProperty(object, RepositoryLayoutHelper.PROP_CLASSIFIER, "fake_" + i); i++; } Map<String, DependencyMetadata> metadata = new LinkedHashMap<String, DependencyMetadata>(); metadata.put(null, dm); fake.setContextValue("tpmp.aggregatedMetadata", metadata); return fake; }
From source file:org.wso2.maven.plugin.jaxws.JaxWSPOMGenMojo.java
License:Open Source License
protected void addPlugins(MavenProject artifactMavenProject, Artifact artifact) { if (artifact.getFile().getPath().endsWith(".jar")) { Plugin plugin = CAppMavenUtils.createPluginEntry(artifactMavenProject, "org.wso2.maven", "maven-jaxws-plugin", WSO2MavenPluginConstantants.MAVEN_JAXWS_PLUGIN_VERSION, true); // Plugin plugin = CAppMavenUtils.createPluginEntry(artifactMavenProject,"org.apache.maven.plugins","maven-jar-plugin","2.3.1",true); Xpp3Dom configuration = (Xpp3Dom) plugin.getConfiguration(); //add configuration Xpp3Dom aritfact = CAppMavenUtils.createConfigurationNode(configuration, "artifact"); aritfact.setValue(artifact.getFile().getName()); } else {//from w w w . j a v a2 s.co m artifactMavenProject.setPackaging("jar"); artifactMavenProject.getModel().addProperty(CAppUtils.PROPERTY_CAPP_TYPE, getArtifactType()); getLog().info("Adding JAXWS reated plugins"); Plugin plugin = CAppMavenUtils.createPluginEntry(artifactMavenProject, "org.apache.maven.plugins", "maven-dependency-plugin", "2.2", true); PluginExecution execution = new PluginExecution(); execution.setId("unpack"); execution.setPhase("package"); List<String> goals = new ArrayList<String>(); goals.add("unpack"); execution.setGoals(goals); plugin.addExecution(execution); Xpp3Dom config = (Xpp3Dom) plugin.getConfiguration(); Xpp3Dom artifactItems = CAppMavenUtils.createConfigurationNode(config, "artifactItems"); Xpp3Dom artifactItem = CAppMavenUtils.createConfigurationNode(artifactItems, "artifactItem"); List<ProjectMapping> projectMappings; String serviceProject = null; Properties properties = new Properties(); try { properties.load(new FileInputStream(artifact.getFile())); serviceProject = properties.getProperty("Projects"); } catch (FileNotFoundException e1) { e1.printStackTrace(); } catch (IOException e1) { e1.printStackTrace(); } try { projectMappings = getProjectMappings(); for (int i = 0; i < projectMappings.size(); i++) { ProjectMapping projectMapping = projectMappings.get(i); if (projectMapping.projectName.equalsIgnoreCase(serviceProject)) { Xpp3Dom groupId = CAppMavenUtils.createConfigurationNode(artifactItem, "groupId"); groupId.setValue(projectMapping.getGroupId()); Xpp3Dom artifactId = CAppMavenUtils.createConfigurationNode(artifactItem, "artifactId"); artifactId.setValue(projectMapping.getArtifactId()); Xpp3Dom version = CAppMavenUtils.createConfigurationNode(artifactItem, "version"); version.setValue(projectMapping.getVersion()); Xpp3Dom type = CAppMavenUtils.createConfigurationNode(artifactItem, "type"); type.setValue("jar"); Xpp3Dom overWrite = CAppMavenUtils.createConfigurationNode(artifactItem, "overWrite"); overWrite.setValue("true"); Xpp3Dom outputDirectory = CAppMavenUtils.createConfigurationNode(artifactItem, "outputDirectory"); outputDirectory.setValue("target" + File.separator + "jar"); } } } catch (Exception e) { getLog().error(e); } //Adding Jar plugin entry to build section Plugin pluginJaxWs = CAppMavenUtils.createPluginEntry(artifactMavenProject, "org.apache.maven.plugins", "maven-jar-plugin", "2.3.1", true); PluginExecution executionJaxWs = new PluginExecution(); executionJaxWs.setId("jar"); executionJaxWs.setPhase("package"); List<String> goalsJaxWs = new ArrayList<String>(); goalsJaxWs.add("jar"); executionJaxWs.setGoals(goalsJaxWs); Xpp3Dom mainNode = MavenUtils.createMainConfigurationNode(); pluginJaxWs.setConfiguration(mainNode); Xpp3Dom classDirNode = MavenUtils.createConfigurationNode(mainNode, "classesDirectory"); classDirNode.setValue("target" + File.separator + "jar"); Xpp3Dom includes = MavenUtils.createConfigurationNode(mainNode, "includes"); Xpp3Dom include = MavenUtils.createConfigurationNode(includes, "include"); include.setValue("**/*.class"); Xpp3Dom forceCreation = MavenUtils.createConfigurationNode(mainNode, "forceCreation"); forceCreation.setValue("true"); pluginJaxWs.setConfiguration(mainNode); pluginJaxWs.addExecution(executionJaxWs); } }