mirror of https://github.com/apache/maven.git
[MNG-4456] Deprecate fully qualified pathnames in system path
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@882677 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7a5ccb383b
commit
f2d48a06ad
|
@ -367,6 +367,15 @@ public class DefaultModelValidator
|
|||
{
|
||||
addViolation( problems, Severity.ERROR, "'" + prefix + ".classifier' must be empty for imported POM: " + key );
|
||||
}
|
||||
else if ( "system".equals( dependency.getScope() ) )
|
||||
{
|
||||
String sysPath = dependency.getSystemPath();
|
||||
if ( StringUtils.isNotEmpty( sysPath ) && !hasExpression( sysPath ) )
|
||||
{
|
||||
addViolation( problems, Severity.WARNING, "'" + prefix
|
||||
+ ".systemPath' should use a variable instead of a hard-coded path: " + key + " -> " + sysPath );
|
||||
}
|
||||
}
|
||||
|
||||
Dependency existing = index.get( key );
|
||||
|
||||
|
|
|
@ -403,4 +403,14 @@ public class DefaultModelValidatorTest
|
|||
assertTrue( result.getFatals().get( 2 ).contains( "parent.version" ) );
|
||||
}
|
||||
|
||||
public void testHardCodedSystemPath()
|
||||
throws Exception
|
||||
{
|
||||
SimpleProblemCollector result = validateRaw( "hard-coded-system-path.xml" );
|
||||
|
||||
assertViolations( result, 0, 0, 1 );
|
||||
|
||||
assertTrue( result.getWarnings().get( 0 ).contains( "test:a:jar" ) );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); you may not use this file except in compliance
|
||||
with the License. You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing,
|
||||
software distributed under the License is distributed on an
|
||||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, either express or implied. See the License for the
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
-->
|
||||
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>aid</artifactId>
|
||||
<groupId>gid</groupId>
|
||||
<version>0.1</version>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>test</groupId>
|
||||
<artifactId>a</artifactId>
|
||||
<version>0.2</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>should-use-variables-and-not-hard-code-this-path</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>test</groupId>
|
||||
<artifactId>b</artifactId>
|
||||
<version>0.1</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/lib/good.jar</systemPath>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
Loading…
Reference in New Issue