Search in sources :

Example 21 with SimpleProblemCollector

use of org.apache.maven.model.building.SimpleProblemCollector in project maven by apache.

the class DefaultModelValidatorTest method testBadPluginVersion.

@Test
public void testBadPluginVersion() throws Exception {
    SimpleProblemCollector result = validate("bad-plugin-version.xml");
    assertViolations(result, 0, 4, 0);
    assertContains(result.getErrors().get(0), "'build.plugins.plugin.version' for test:mip must be a valid version");
    assertContains(result.getErrors().get(1), "'build.plugins.plugin.version' for test:rmv must be a valid version");
    assertContains(result.getErrors().get(2), "'build.plugins.plugin.version' for test:lmv must be a valid version");
    assertContains(result.getErrors().get(3), "'build.plugins.plugin.version' for test:ifsc must not contain any of these characters");
}
Also used : SimpleProblemCollector(org.apache.maven.model.building.SimpleProblemCollector) Test(org.junit.jupiter.api.Test)

Example 22 with SimpleProblemCollector

use of org.apache.maven.model.building.SimpleProblemCollector in project maven by apache.

the class DefaultModelValidatorTest method testBadSnapshotVersion.

@Test
public void testBadSnapshotVersion() throws Exception {
    SimpleProblemCollector result = validate("bad-snapshot-version.xml");
    assertViolations(result, 0, 1, 0);
    assertContains(result.getErrors().get(0), "'version' uses an unsupported snapshot version format");
}
Also used : SimpleProblemCollector(org.apache.maven.model.building.SimpleProblemCollector) Test(org.junit.jupiter.api.Test)

Example 23 with SimpleProblemCollector

use of org.apache.maven.model.building.SimpleProblemCollector in project maven by apache.

the class DefaultModelValidatorTest method testDeprecatedDependencyMetaversionsLatestAndRelease.

@Test
public void testDeprecatedDependencyMetaversionsLatestAndRelease() throws Exception {
    SimpleProblemCollector result = validateRaw("deprecated-dependency-metaversions-latest-and-release.xml");
    assertViolations(result, 0, 0, 2);
    assertContains(result.getWarnings().get(0), "'dependencies.dependency.version' for test:a:jar is either LATEST or RELEASE (both of them are being deprecated)");
    assertContains(result.getWarnings().get(1), "'dependencies.dependency.version' for test:b:jar is either LATEST or RELEASE (both of them are being deprecated)");
}
Also used : SimpleProblemCollector(org.apache.maven.model.building.SimpleProblemCollector) Test(org.junit.jupiter.api.Test)

Example 24 with SimpleProblemCollector

use of org.apache.maven.model.building.SimpleProblemCollector in project maven by apache.

the class DefaultModelValidatorTest method testSystemPathRefersToProjectBasedir.

@Test
public void testSystemPathRefersToProjectBasedir() throws Exception {
    SimpleProblemCollector result = validateRaw("basedir-system-path.xml");
    assertViolations(result, 0, 0, 4);
    assertContains(result.getWarnings().get(0), "'dependencies.dependency.scope' for test:a:jar declares usage of deprecated 'system' scope");
    assertContains(result.getWarnings().get(1), "'dependencies.dependency.systemPath' for test:a:jar should not point at files within the project directory");
    assertContains(result.getWarnings().get(2), "'dependencies.dependency.scope' for test:b:jar declares usage of deprecated 'system' scope");
    assertContains(result.getWarnings().get(3), "'dependencies.dependency.systemPath' for test:b:jar should not point at files within the project directory");
}
Also used : SimpleProblemCollector(org.apache.maven.model.building.SimpleProblemCollector) Test(org.junit.jupiter.api.Test)

Example 25 with SimpleProblemCollector

use of org.apache.maven.model.building.SimpleProblemCollector in project maven by apache.

the class DefaultModelValidatorTest method testInvalidAggregatorPackaging.

@Test
public void testInvalidAggregatorPackaging() throws Exception {
    SimpleProblemCollector result = validate("invalid-aggregator-packaging-pom.xml");
    assertViolations(result, 0, 1, 0);
    assertTrue(result.getErrors().get(0).contains("Aggregator projects require 'pom' as packaging."));
}
Also used : SimpleProblemCollector(org.apache.maven.model.building.SimpleProblemCollector) Test(org.junit.jupiter.api.Test)

Aggregations

SimpleProblemCollector (org.apache.maven.model.building.SimpleProblemCollector)102 Test (org.junit.jupiter.api.Test)97 Model (org.apache.maven.model.Model)37 File (java.io.File)26 Properties (java.util.Properties)21 DefaultModelBuildingRequest (org.apache.maven.model.building.DefaultModelBuildingRequest)20 ModelBuildingRequest (org.apache.maven.model.building.ModelBuildingRequest)16 ArrayList (java.util.ArrayList)4 HashMap (java.util.HashMap)4 Dependency (org.apache.maven.model.Dependency)4 Scm (org.apache.maven.model.Scm)3 Organization (org.apache.maven.model.Organization)2 Repository (org.apache.maven.model.Repository)2 CountDownLatch (java.util.concurrent.CountDownLatch)1 Future (java.util.concurrent.Future)1 FutureTask (java.util.concurrent.FutureTask)1 Build (org.apache.maven.model.Build)1 InputLocation (org.apache.maven.model.InputLocation)1 InputSource (org.apache.maven.model.InputSource)1 Resource (org.apache.maven.model.Resource)1