Java Code Examples for org.apache.maven.project.MavenProject#setGroupId()
The following examples show how to use
org.apache.maven.project.MavenProject#setGroupId() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: A_ModuleGenerator.java From deadcode4j with Apache License 2.0 | 6 votes |
private MavenProject givenMavenProject(String projectId) { MavenProject mavenProject = new MavenProject(); mavenProject.setGroupId("de.is24.junit"); mavenProject.setArtifactId(projectId); mavenProject.setVersion("42"); mavenProject.getProperties().setProperty("project.build.sourceEncoding", "UTF-8"); ArtifactStub projectArtifact = new ArtifactStub(); projectArtifact.setGroupId("de.is24.junit"); projectArtifact.setArtifactId(projectId); projectArtifact.setVersion("42"); mavenProject.setArtifact(projectArtifact); Build build = new Build(); build.setOutputDirectory(tempFileRule.getTempFile().getParent()); mavenProject.setBuild(build); return mavenProject; }
Example 2
Source File: MavenUtilsTest.java From wisdom with Apache License 2.0 | 6 votes |
@Test public void testGetDefaultPropertiesOnProjectWithProperties() throws Exception { Model model = new Model(); model.setPomFile(new File("target/test-classes/maven/test/minimal.xml")); MavenProject project = new MavenProject(model); project.setFile(new File("target/test-classes/maven/test/minimal.xml")); project.setArtifactId("acme"); project.setGroupId("corp.acme"); project.setVersion("1.0.0-SNAPSHOT"); final ProjectArtifact artifact = new ProjectArtifact(project); project.setArtifact(artifact); Build build = new Build(); build.setDirectory(new File(project.getBasedir(), "target").getAbsolutePath()); build.setOutputDirectory(new File(project.getBasedir(), "target/classes").getAbsolutePath()); project.setBuild(build); Properties props = new Properties(); props.put("p", "v"); model.setProperties(props); Properties properties = MavenUtils.getDefaultProperties(project); assertThat(properties.getProperty("p")).isEqualTo("v"); }
Example 3
Source File: ApiGatewayTest.java From lambadaframework with MIT License | 6 votes |
protected LambadaDeployer getExampleProject() { MavenProject project = new MavenProject(); project.getProperties().setProperty("deployment.bucket", "maven.cagataygurturk.com"); project.setGroupId("org.lambadaframework"); project.setArtifactId("runtime-deploy-maven-plugin"); project.setVersion("0.0.2"); Properties props = new Properties(); props.put("ProjectName", "LambadaTestProject"); LambadaDeployer deployer = new LambadaDeployer(); deployer.mavenProject = project; deployer.stageToDeploy = "dev"; deployer.regionToDeploy = "eu-west-1"; //deployer.cloudFormationParameters = props; return deployer; }
Example 4
Source File: MainTest.java From lambadaframework with MIT License | 6 votes |
protected LambadaDeployer getExampleProject() { MavenProject project = new MavenProject(); project.getProperties().setProperty("deployment.bucket", "maven.cagataygurturk.com"); project.setGroupId("com.home24.lambdadeploy"); project.setArtifactId("runtime-deploy-maven-plugin"); project.setVersion("0.0.2"); Properties props = new Properties(); props.put("ProjectName", "MobileApi"); LambadaDeployer deployer = new LambadaDeployer(); deployer.mavenProject = project; deployer.stageToDeploy = "dev"; deployer.regionToDeploy = "eu-west-1"; return deployer; }
Example 5
Source File: ValidateApplicationMojoTest.java From roboconf-platform with Apache License 2.0 | 6 votes |
@Test public void testRecipe_official_anotherGroupId() throws Exception { // Find and execute the mojo ValidateApplicationMojo mojo = retriveAndPrepareMojo( "recipe" ); MavenProject project = (MavenProject) this.rule.getVariableValueFromObject( mojo, "project" ); this.rule.setVariableValueToObject( mojo, "recipe", true ); this.rule.setVariableValueToObject( mojo, "official", true ); project.setGroupId( Constants.OFFICIAL_RECIPES_GROUP_ID + ".database" ); project.setArtifactId( project.getName()); Assert.assertTrue( new File( project.getBasedir(), "readme" ).createNewFile()); mojo.execute(); // We should not have a result file File resultsFile = new File( project.getBasedir(), MavenPluginConstants.VALIDATION_RESULT_PATH ); Assert.assertFalse( resultsFile.exists()); }
Example 6
Source File: ValidateApplicationMojoTest.java From roboconf-platform with Apache License 2.0 | 6 votes |
@Test public void testRecipe_official_exactGroupId() throws Exception { // Find and execute the mojo ValidateApplicationMojo mojo = retriveAndPrepareMojo( "recipe" ); MavenProject project = (MavenProject) this.rule.getVariableValueFromObject( mojo, "project" ); this.rule.setVariableValueToObject( mojo, "recipe", true ); this.rule.setVariableValueToObject( mojo, "official", true ); project.setGroupId( Constants.OFFICIAL_RECIPES_GROUP_ID ); project.setArtifactId( project.getName()); Assert.assertTrue( new File( project.getBasedir(), "readme" ).createNewFile()); mojo.execute(); // We should not have a result file File resultsFile = new File( project.getBasedir(), MavenPluginConstants.VALIDATION_RESULT_PATH ); Assert.assertFalse( resultsFile.exists()); }
Example 7
Source File: ReleasableModuleTest.java From multi-module-maven-release-plugin with MIT License | 6 votes |
@Test public void aReleaseableModuleCanBeCreatedFromAnUnreleasableOne() { MavenProject project = new MavenProject(); project.setArtifactId("some-arty"); project.setGroupId("some-group"); ReleasableModule first = new ReleasableModule( project, new VersionName("1.2.3-SNAPSHOT", "1.2.3", 12), "1.2.3.11", "somewhere" ); assertThat(first.willBeReleased(), is(false)); ReleasableModule changed = first.createReleasableVersion(); assertThat(changed.getArtifactId(), equalTo("some-arty")); assertThat(changed.getBuildNumber(), equalTo(12L)); assertThat(changed.getGroupId(), equalTo("some-group")); assertThat(changed.getNewVersion(), equalTo("1.2.3.12")); assertThat(changed.getProject(), is(project)); assertThat(changed.getRelativePathToModule(), equalTo("somewhere")); assertThat(changed.willBeReleased(), is(true)); }
Example 8
Source File: MavenUtilTest.java From jkube with Eclipse Public License 2.0 | 6 votes |
private MavenProject getMavenProject() { MavenProject mavenProject = new MavenProject(); mavenProject.setName("testProject"); mavenProject.setGroupId("org.eclipse.jkube"); mavenProject.setArtifactId("test-project"); mavenProject.setVersion("0.1.0"); mavenProject.setDescription("test description"); Build build = new Build(); build.setOutputDirectory("./target"); build.setDirectory("."); mavenProject.setBuild(build); DistributionManagement distributionManagement = new DistributionManagement(); Site site = new Site(); site.setUrl("https://www.eclipse.org/jkube/"); distributionManagement.setSite(site); mavenProject.setDistributionManagement(distributionManagement); return mavenProject; }
Example 9
Source File: JenkinsMavenEventSpyMTTest.java From pipeline-maven-plugin with MIT License | 5 votes |
private JenkinsMavenEventSpy createSpy() throws Exception { FileMavenEventReporter reporter = new FileMavenEventReporter(); JenkinsMavenEventSpy spy = new JenkinsMavenEventSpy(reporter) { @Override protected boolean isEventSpyDisabled() { return false; } }; spy.init(new EventSpy.Context() { @Override public Map<String, Object> getData() { return new HashMap(); } }); MavenXpp3Reader mavenXpp3Reader = new MavenXpp3Reader(); InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream("org/jenkinsci/plugins/pipeline/maven/eventspy/pom.xml"); Assert.assertThat(in, CoreMatchers.notNullValue()); Model model = mavenXpp3Reader.read(in); project = new MavenProject(model); project.setGroupId(model.getGroupId()); project.setArtifactId(model.getArtifactId()); project.setVersion(model.getVersion()); project.setName(model.getName()); return spy; }
Example 10
Source File: MavenUtilsTest.java From wisdom with Apache License 2.0 | 5 votes |
@Test public void testGetDefaultPropertiesOnMinimalPom() throws Exception { Model model = new Model(); model.setPomFile(new File("target/test-classes/maven/test/minimal.xml")); MavenProject project = new MavenProject(model); project.setFile(new File("target/test-classes/maven/test/minimal.xml")); project.setArtifactId("acme"); project.setGroupId("corp.acme"); project.setVersion("1.0.0-SNAPSHOT"); final ProjectArtifact artifact = new ProjectArtifact(project); project.setArtifact(artifact); Build build = new Build(); build.setDirectory(new File(project.getBasedir(), "target").getAbsolutePath()); build.setOutputDirectory(new File(project.getBasedir(), "target/classes").getAbsolutePath()); project.setBuild(build); Properties properties = MavenUtils.getDefaultProperties(project); assertThat(properties.getProperty("maven-symbolicname")).isEqualTo(DefaultMaven2OsgiConverter .getBundleSymbolicName(artifact)); assertThat(properties.getProperty(org.osgi.framework.Constants.BUNDLE_SYMBOLICNAME)).isEqualTo(DefaultMaven2OsgiConverter .getBundleSymbolicName(artifact)); assertThat(properties.getProperty(org.osgi.framework.Constants.BUNDLE_VERSION)).isEqualTo(DefaultMaven2OsgiConverter .getVersion(project.getVersion())); assertThat(properties.getProperty(org.osgi.framework.Constants.BUNDLE_DESCRIPTION)).isNull(); assertThat(properties.getProperty(Analyzer.BUNDLE_LICENSE)).isNull(); assertThat(properties.getProperty(Analyzer.BUNDLE_VENDOR)).isNull(); assertThat(properties.getProperty(Analyzer.BUNDLE_DOCURL)).isNull(); assertThat(properties.getProperty(Analyzer.BUNDLE_LICENSE)).isNull(); assertThat(properties.getProperty(Analyzer.BUNDLE_NAME)).isEqualTo(project.getArtifactId()); }
Example 11
Source File: AbstractSmartBuilderTest.java From takari-smart-builder with Apache License 2.0 | 5 votes |
protected MavenProject newProject(String artifactId) { MavenProject project = new MavenProject(); project.setGroupId("test"); project.setArtifactId(artifactId); project.setVersion("1"); return project; }
Example 12
Source File: RequirePropertyDivergesTest.java From extra-enforcer-rules with Apache License 2.0 | 5 votes |
static MavenProject createMavenProject( final String groupId, final String artifactId ) { final MavenProject project = new MavenProject(); project.setGroupId( groupId ); project.setArtifactId( artifactId ); project.setOriginalModel( new Model() ); return project; }
Example 13
Source File: JenkinsMavenEventSpyTest.java From pipeline-maven-plugin with MIT License | 5 votes |
@Before public void before() throws Exception { reporter = new OutputStreamEventReporter(writer); spy = new JenkinsMavenEventSpy(reporter) { @Override protected boolean isEventSpyDisabled() { return false; } }; spy.init(new EventSpy.Context() { @Override public Map<String, Object> getData() { return new HashMap(); } }); MavenXpp3Reader mavenXpp3Reader = new MavenXpp3Reader(); InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream("org/jenkinsci/plugins/pipeline/maven/eventspy/pom.xml"); Assert.assertThat(in, CoreMatchers.notNullValue()); Model model = mavenXpp3Reader.read(in); project = new MavenProject(model); project.setGroupId(model.getGroupId()); project.setArtifactId(model.getArtifactId()); project.setVersion(model.getVersion()); project.setName(model.getName()); }
Example 14
Source File: MavenSessionMock.java From gitflow-incremental-builder with MIT License | 5 votes |
private static MavenProject createProject(Path path) { MavenProject project = new MavenProject(); Model model = new Model(); model.setProperties(new Properties()); project.setModel(model); project.setArtifactId(path.getFileName().toString()); project.setGroupId(path.getFileName().toString()); project.setVersion("1"); project.setFile(path.resolve("pom.xml").toFile()); return project; }
Example 15
Source File: ProjectToCoordinatesTest.java From unleash-maven-plugin with Eclipse Public License 1.0 | 5 votes |
private static MavenProject createProject(String gid, String aid, String version, String packaging) { MavenProject p = new MavenProject(); p.setGroupId(gid); p.setArtifactId(aid); p.setVersion(version); p.setPackaging(packaging); return p; }
Example 16
Source File: ProjectToStringTest.java From unleash-maven-plugin with Eclipse Public License 1.0 | 5 votes |
private static MavenProject createProject(String gid, String aid, String version, String packaging) { MavenProject p = new MavenProject(); p.setGroupId(gid); p.setArtifactId(aid); p.setVersion(version); p.setPackaging(packaging); return p; }
Example 17
Source File: IsSnapshotProjectTest.java From unleash-maven-plugin with Eclipse Public License 1.0 | 5 votes |
private static MavenProject createProject(String version) { MavenProject p = new MavenProject(); p.setGroupId("x"); p.setArtifactId("x"); p.setVersion(version); return p; }
Example 18
Source File: MavenProjectCache.java From netbeans with Apache License 2.0 | 5 votes |
@NbBundle.Messages({ "LBL_Incomplete_Project_Name=<partially loaded Maven project>", "LBL_Incomplete_Project_Desc=Partially loaded Maven project; try building it." }) public static MavenProject getFallbackProject(File projectFile) throws AssertionError { MavenProject newproject = new MavenProject(); newproject.setGroupId("error"); newproject.setArtifactId("error"); newproject.setVersion("0"); newproject.setPackaging("pom"); newproject.setName(Bundle.LBL_Incomplete_Project_Name()); newproject.setDescription(Bundle.LBL_Incomplete_Project_Desc()); newproject.setFile(projectFile); return newproject; }
Example 19
Source File: SCMManifestCustomizerTest.java From vertx-maven-plugin with Apache License 2.0 | 5 votes |
private MavenProject createProject() { MavenProject project = new MavenProject(); project.setArtifactId("acme"); project.setGroupId("org.acme"); project.setVersion("1.0-SNAPSHOT"); return project; }
Example 20
Source File: MavenUtilsTest.java From wisdom with Apache License 2.0 | 4 votes |
@Test public void testGetDefaultPropertiesOnProjectWithLicenses() throws Exception { Model model = new Model(); model.setPomFile(new File("target/test-classes/maven/test/minimal.xml")); MavenProject project = new MavenProject(model); project.setFile(new File("target/test-classes/maven/test/minimal.xml")); project.setArtifactId("acme"); project.setGroupId("corp.acme"); project.setVersion("1.0.0-SNAPSHOT"); final ProjectArtifact artifact = new ProjectArtifact(project); project.setArtifact(artifact); Build build = new Build(); build.setDirectory(new File(project.getBasedir(), "target").getAbsolutePath()); build.setOutputDirectory(new File(project.getBasedir(), "target/classes").getAbsolutePath()); project.setBuild(build); License license = new License(); license.setDistribution("repo"); license.setName("Apache Software License 2.0"); license.setUrl("http://www.apache.org/licenses/"); project.setLicenses(ImmutableList.of(license)); Organization organization = new Organization(); organization.setName("Acme Corp."); organization.setUrl("http://acme.org"); project.setOrganization(organization); project.setDescription("description"); Properties properties = MavenUtils.getDefaultProperties(project); assertThat(properties.getProperty(Analyzer.BUNDLE_LICENSE)).contains(license.getUrl()); assertThat(properties.getProperty(Analyzer.BUNDLE_VENDOR)).isEqualTo("Acme Corp."); assertThat(properties.getProperty(Analyzer.BUNDLE_DOCURL)).isEqualTo(organization.getUrl()); assertThat(properties.getProperty(Analyzer.BUNDLE_DESCRIPTION)).isEqualTo("description"); License license2 = new License(); license2.setDistribution("repo"); license2.setName("Apache Software License 2.0"); license2.setUrl("http://www.apache.org/LICENSE.txt"); project.setLicenses(ImmutableList.of(license, license2)); properties = MavenUtils.getDefaultProperties(project); assertThat(properties.getProperty(Analyzer.BUNDLE_LICENSE)).contains(license.getUrl()).contains(license2.getUrl()); }