Skip to content
GitLab
Explore
Sign in
Register
Commits on Source (2)
New upstream version 3.0.0~M1
· 25e7b698
Emmanuel Bourg
authored
Sep 12, 2017
25e7b698
New upstream version 3.0.0~M2
· ef7173bb
Emmanuel Bourg
authored
Oct 10, 2018
ef7173bb
Show whitespace changes
Inline
Side-by-side
Jenkinsfile
0 → 100644
View file @
ef7173bb
/**
* 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.
*/
asfMavenTlpStdBuild
()
enforcer-api/pom.xml
View file @
ef7173bb
...
...
@@ -24,7 +24,7 @@
<parent>
<groupId>
org.apache.maven.enforcer
</groupId>
<artifactId>
enforcer
</artifactId>
<version>
1.4.
2
</version>
<version>
3.0.0-M
2
</version>
</parent>
<artifactId>
enforcer-api
</artifactId>
...
...
enforcer-api/src/main/java/org/apache/maven/enforcer/rule/api/EnforcerRule.java
View file @
ef7173bb
...
...
@@ -26,7 +26,7 @@ import javax.annotation.Nullable;
* Interface to be implemented by any rules executed by the enforcer.
*
* @author <a href="mailto:brianf@apache.org">Brian Fox</a>
* @version $Id
: EnforcerRule.java 1663790 2015-03-03 21:07:38Z khmarbaise
$
* @version $Id$
*/
public
interface
EnforcerRule
{
...
...
@@ -57,7 +57,10 @@ public interface EnforcerRule
boolean
isCacheable
();
/**
* Checks if cached result is valid.
* If the rule is cacheable and the same id is found in the cache, the stored results are passed to this method to
* allow double checking of the results. Most of the time this can be done by generating unique ids, but sometimes
* the results of objects returned by the helper need to be queried. You may for example, store certain objects in
* your rule and then query them later.
*
* @param cachedRule the last cached instance of the rule. This is to be used by the rule to
* potentially determine if the results are still valid (ie if the configuration has been overridden)
...
...
enforcer-api/src/main/java/org/apache/maven/enforcer/rule/api/EnforcerRule2.java
View file @
ef7173bb
...
...
@@ -25,7 +25,7 @@ import javax.annotation.Nonnull;
* Interface to be implemented by any rules as of version 2.0 executed by the enforcer.
*
* @author Mirko Friedenhagen
* @version $Id
: EnforcerRule2.java 1663790 2015-03-03 21:07:38Z khmarbaise
$
* @version $Id$
* @since 1.4
*/
public
interface
EnforcerRule2
extends
EnforcerRule
...
...
enforcer-api/src/main/java/org/apache/maven/enforcer/rule/api/EnforcerRuleHelper.java
View file @
ef7173bb
...
...
@@ -59,7 +59,7 @@ public interface EnforcerRuleHelper
* @throws ComponentLookupException the component lookup exception
*/
@Nonnull
Object
getComponent
(
Class
clazz
)
<
T
>
T
getComponent
(
Class
<
T
>
clazz
)
throws
ComponentLookupException
;
/**
...
...
@@ -88,6 +88,19 @@ public interface EnforcerRuleHelper
Object
getComponent
(
String
role
,
String
roleHint
)
throws
ComponentLookupException
;
/**
* Gets the component.
*
* @param clazz the clazz
* @param roleHint the role hint
*
* @return the component
*
* @throws ComponentLookupException the component lookup exception
*/
<
T
>
T
getComponent
(
Class
<
T
>
clazz
,
String
roleHint
)
throws
ComponentLookupException
;
/**
* Gets the component map.
*
...
...
@@ -97,7 +110,7 @@ public interface EnforcerRuleHelper
*
* @throws ComponentLookupException the component lookup exception
*/
Map
getComponentMap
(
String
role
)
Map
<
String
,
?>
getComponentMap
(
String
role
)
throws
ComponentLookupException
;
/**
...
...
@@ -109,7 +122,7 @@ public interface EnforcerRuleHelper
*
* @throws ComponentLookupException the component lookup exception
*/
List
getComponentList
(
String
role
)
List
<?>
getComponentList
(
String
role
)
throws
ComponentLookupException
;
/**
...
...
enforcer-rules/pom.xml
View file @
ef7173bb
...
...
@@ -24,7 +24,7 @@
<parent>
<groupId>
org.apache.maven.enforcer
</groupId>
<artifactId>
enforcer
</artifactId>
<version>
1.4.
2
</version>
<version>
3.0.0-M
2
</version>
</parent>
<artifactId>
enforcer-rules
</artifactId>
...
...
@@ -61,7 +61,6 @@
<dependency>
<groupId>
org.apache.commons
</groupId>
<artifactId>
commons-lang3
</artifactId>
<version>
3.5
</version>
</dependency>
<dependency>
<groupId>
commons-codec
</groupId>
...
...
@@ -90,11 +89,6 @@
<groupId>
org.apache.maven.shared
</groupId>
<artifactId>
maven-dependency-tree
</artifactId>
</dependency>
<dependency>
<groupId>
org.codehaus.plexus
</groupId>
<artifactId>
plexus-i18n
</artifactId>
<version>
1.0-beta-6
</version>
</dependency>
<dependency>
<groupId>
org.apache.maven
</groupId>
<artifactId>
maven-compat
</artifactId>
...
...
enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractBanDependencies.java
View file @
ef7173bb
...
...
@@ -36,7 +36,7 @@ import java.util.Set;
* Abstract Rule for banning dependencies.
*
* @author <a href="mailto:brianf@apache.org">Brian Fox</a>
* @version $Id
: AbstractBanDependencies.java 1630934 2014-10-10 16:35:26Z khmarbaise
$
* @version $Id$
*/
public
abstract
class
AbstractBanDependencies
extends
AbstractNonCacheableEnforcerRule
...
...
@@ -47,12 +47,7 @@ public abstract class AbstractBanDependencies
private
transient
DependencyGraphBuilder
graphBuilder
;
/**
* Execute the rule.
*
* @param helper the helper
* @throws EnforcerRuleException the enforcer rule exception
*/
@Override
public
void
execute
(
EnforcerRuleHelper
helper
)
throws
EnforcerRuleException
{
...
...
enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractNonCacheableEnforcerRule.java
View file @
ef7173bb
...
...
@@ -26,40 +26,26 @@ import org.apache.maven.enforcer.rule.api.EnforcerRule;
* that don't need caching... it saves implementing a bunch of methods.
*
* @author <a href="mailto:brianf@apache.org">Brian Fox</a>
* @version $Id
: AbstractNonCacheableEnforcerRule.java 805190 2009-08-17 22:30:49Z hboutemy
$
* @version $Id$
*/
public
abstract
class
AbstractNonCacheableEnforcerRule
extends
AbstractStandardEnforcerRule
{
/*
* (non-Javadoc)
*
* @see org.apache.maven.enforcer.rule.api.EnforcerRule#getCacheId()
*/
@Override
public
String
getCacheId
()
{
return
"0"
;
}
/*
* (non-Javadoc)
*
* @see org.apache.maven.enforcer.rule.api.EnforcerRule#isCacheable()
*/
@Override
public
boolean
isCacheable
()
{
return
false
;
}
/*
* (non-Javadoc)
*
* @see org.apache.maven.enforcer.rule.api.EnforcerRule#isResultValid(org.apache.maven.enforcer.rule.api.EnforcerRule)
*/
@Override
public
boolean
isResultValid
(
EnforcerRule
cachedRule
)
{
return
false
;
}
}
enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractPropertyEnforcerRule.java
View file @
ef7173bb
...
...
@@ -27,7 +27,7 @@ import org.apache.maven.enforcer.rule.api.EnforcerRuleHelper;
*
* @author Paul Gier
* @author <a href='mailto:marvin[at]marvinformatics[dot]com'>Marvin Froeder</a>
* @version $Id
: AbstractPropertyEnforcerRule.java 1697215 2015-08-23 16:27:17Z khmarbaise
$
* @version $Id$
*/
public
abstract
class
AbstractPropertyEnforcerRule
extends
AbstractNonCacheableEnforcerRule
...
...
@@ -94,13 +94,7 @@ public abstract class AbstractPropertyEnforcerRule
return
regexMessage
;
}
/**
* Execute the rule.
*
* @param helper the helper
* @throws EnforcerRuleException the enforcer rule exception
*/
@Override
public
void
execute
(
EnforcerRuleHelper
helper
)
throws
EnforcerRuleException
{
...
...
enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractRequireFiles.java
View file @
ef7173bb
...
...
@@ -59,11 +59,7 @@ public abstract class AbstractRequireFiles
*/
abstract
String
getErrorMsg
();
/*
* (non-Javadoc)
*
* @see org.apache.maven.enforcer.rule.api.EnforcerRule#execute(org.apache.maven.enforcer.rule.api.EnforcerRuleHelper)
*/
@Override
public
void
execute
(
EnforcerRuleHelper
helper
)
throws
EnforcerRuleException
{
...
...
@@ -114,14 +110,7 @@ public abstract class AbstractRequireFiles
}
}
/**
* If your rule is cacheable, you must return a unique id when parameters or conditions change that would cause the
* result to be different. Multiple cached results are stored based on their id. The easiest way to do this is to
* return a hash computed from the values of your parameters. If your rule is not cacheable, then the result here is
* not important, you may return anything.
*
* @return the cache id
*/
@Override
public
String
getCacheId
()
{
return
Integer
.
toString
(
hashCode
(
files
)
);
...
...
@@ -149,27 +138,13 @@ public abstract class AbstractRequireFiles
return
hash
;
}
/**
* This tells the system if the results are cacheable at all. Keep in mind that during forked builds and other
* things, a given rule may be executed more than once for the same project. This means that even things that change
* from project to project may still be cacheable in certain instances.
*
* @return <code>true</code> if rule is cacheable
*/
@Override
public
boolean
isCacheable
()
{
return
true
;
}
/**
* If the rule is cacheable and the same id is found in the cache, the stored results are passed to this method to
* allow double checking of the results. Most of the time this can be done by generating unique ids, but sometimes
* the results of objects returned by the helper need to be queried. You may for example, store certain objects in
* your rule and then query them later.
*
* @param cachedRule the cached rule
* @return <code>true</code> if the stored results are valid for the same id.
*/
@Override
public
boolean
isResultValid
(
EnforcerRule
cachedRule
)
{
return
true
;
...
...
enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractStandardEnforcerRule.java
View file @
ef7173bb
...
...
@@ -49,11 +49,7 @@ public abstract class AbstractStandardEnforcerRule
return
message
;
}
/**
* Returns the level of enforcement.
*
* @return level
*/
@Override
public
EnforcerLevel
getLevel
()
{
return
level
;
...
...
enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AbstractVersionEnforcer.java
View file @
ef7173bb
...
...
@@ -34,7 +34,7 @@ import org.codehaus.plexus.util.StringUtils;
* Contains the common code to compare a version against a version range.
*
* @author <a href="mailto:brianf@apache.org">Brian Fox</a>
* @version $Id
: AbstractVersionEnforcer.java 1791757 2017-04-18 07:52:22Z khmarbaise
$
* @version $Id$
*/
public
abstract
class
AbstractVersionEnforcer
extends
AbstractStandardEnforcerRule
...
...
@@ -150,10 +150,7 @@ public abstract class AbstractVersionEnforcer
return
matched
;
}
/*
* (non-Javadoc)
* @see org.apache.maven.enforcer.rule.api.EnforcerRule#getCacheId()
*/
@Override
public
String
getCacheId
()
{
if
(
StringUtils
.
isNotEmpty
(
version
)
)
...
...
@@ -168,21 +165,14 @@ public abstract class AbstractVersionEnforcer
}
/*
* (non-Javadoc)
* @see org.apache.maven.enforcer.rule.api.EnforcerRule#isCacheable()
*/
@Override
public
boolean
isCacheable
()
{
// the maven version is not going to change between projects in the same build.
return
true
;
}
/*
* (non-Javadoc)
* @see
* org.apache.maven.enforcer.rule.api.EnforcerRule#isResultValid(org.apache.maven.enforcer.rule.api.EnforcerRule)
*/
@Override
public
boolean
isResultValid
(
EnforcerRule
theCachedRule
)
{
// i will always return the hash of the parameters as my id. If my parameters are the same, this
...
...
enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AlwaysFail.java
View file @
ef7173bb
...
...
@@ -31,9 +31,7 @@ public class AlwaysFail
extends
AbstractNonCacheableEnforcerRule
{
/**
* {@inheritDoc}
*/
@Override
public
void
execute
(
EnforcerRuleHelper
helper
)
throws
EnforcerRuleException
{
...
...
enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/AlwaysPass.java
View file @
ef7173bb
...
...
@@ -31,9 +31,7 @@ public class AlwaysPass
extends
AbstractNonCacheableEnforcerRule
{
/**
* {@inheritDoc}
*/
@Override
public
void
execute
(
EnforcerRuleHelper
helper
)
throws
EnforcerRuleException
{
...
...
enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/BanDistributionManagement.java
View file @
ef7173bb
...
...
@@ -38,12 +38,6 @@ public class BanDistributionManagement
extends
AbstractNonCacheableEnforcerRule
{
/**
* If we turn on the <code>ignoreParent</code> the parent will be ignored.
* @deprecated
*/
private
boolean
ignoreParent
=
true
;
/**
* Allow using a repository entry in the distributionManagement area.
*/
...
...
@@ -61,9 +55,7 @@ public class BanDistributionManagement
private
Log
logger
;
/**
* {@inheritDoc}
*/
@Override
public
void
execute
(
EnforcerRuleHelper
helper
)
throws
EnforcerRuleException
{
...
...
@@ -95,11 +87,6 @@ public class BanDistributionManagement
DistributionManagementCheck
check
=
new
DistributionManagementCheck
(
project
);
check
.
execute
(
isAllowRepository
(),
isAllowSnapshotRepository
(),
isAllowSite
()
);
if
(
!
isIgnoreParent
()
)
{
logger
.
warn
(
"You have configured not to ignore the parent."
);
logger
.
warn
(
"This configuration is deprecated and will be ignored."
);
}
}
}
catch
(
ExpressionEvaluationException
e
)
...
...
@@ -108,16 +95,6 @@ public class BanDistributionManagement
}
}
public
boolean
isIgnoreParent
()
{
return
ignoreParent
;
}
public
void
setIgnoreParent
(
boolean
ignoreParent
)
{
this
.
ignoreParent
=
ignoreParent
;
}
public
boolean
isAllowRepository
()
{
return
allowRepository
;
...
...
enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/BanDuplicatePomDependencyVersions.java
View file @
ef7173bb
...
...
@@ -49,7 +49,7 @@ import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
public
class
BanDuplicatePomDependencyVersions
extends
AbstractNonCacheableEnforcerRule
{
@Override
public
void
execute
(
EnforcerRuleHelper
helper
)
throws
EnforcerRuleException
{
...
...
enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/BanTransitiveDependencies.java
View file @
ef7173bb
...
...
@@ -136,6 +136,7 @@ public class BanTransitiveDependencies
return
hasTransitiveDependencies
;
}
@Override
public
void
execute
(
EnforcerRuleHelper
helper
)
throws
EnforcerRuleException
{
...
...
enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/BannedDependencies.java
View file @
ef7173bb
...
...
@@ -35,7 +35,7 @@ import org.apache.maven.plugins.enforcer.utils.ArtifactMatcher.Pattern;
* This rule checks that lists of dependencies are not included.
*
* @author <a href="mailto:brianf@apache.org">Brian Fox</a>
* @version $Id
: BannedDependencies.java 1798818 2017-06-15 10:51:25Z stephenc
$
* @version $Id$
*/
public
class
BannedDependencies
extends
AbstractBanDependencies
...
...
@@ -67,9 +67,7 @@ public class BannedDependencies
*/
private
List
<
String
>
includes
=
null
;
/**
* {@inheritDoc}
*/
@Override
protected
Set
<
Artifact
>
checkDependencies
(
Set
<
Artifact
>
theDependencies
,
Log
log
)
throws
EnforcerRuleException
{
...
...
enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/BannedPlugins.java
View file @
ef7173bb
...
...
@@ -32,12 +32,13 @@ import org.apache.maven.project.MavenProject;
public
class
BannedPlugins
extends
BannedDependencies
{
@Override
protected
Set
<
Artifact
>
getDependenciesToCheck
(
MavenProject
project
)
{
return
project
.
getPluginArtifacts
();
}
@Override
protected
CharSequence
getErrorMessage
(
Artifact
artifact
)
{
return
"Found Banned Plugin: "
+
artifact
.
getId
()
+
"\n"
;
...
...
enforcer-rules/src/main/java/org/apache/maven/plugins/enforcer/BannedRepositories.java
View file @
ef7173bb
...
...
@@ -78,11 +78,7 @@ public class BannedRepositories
// Public methods
// ----------------------------------------------------------------------
/*
* (non-Javadoc)
* @see
* org.apache.maven.enforcer.rule.api.EnforcerRule#execute(org.apache.maven.enforcer.rule.api.EnforcerRuleHelper)
*/
@Override
public
void
execute
(
EnforcerRuleHelper
helper
)
throws
EnforcerRuleException
{
...
...
Prev
1
2
3
4
5
6
Next