mirror of https://github.com/apache/maven.git
prepare provides before configuration, to follown descriptor logic
This commit is contained in:
parent
44174308a6
commit
b8d220c686
|
@ -35,6 +35,7 @@ import org.codehaus.plexus.util.FileUtils;
|
||||||
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* JDK toolchain factory.
|
||||||
*
|
*
|
||||||
* @author mkleint
|
* @author mkleint
|
||||||
* @since 2.0.9
|
* @since 2.0.9
|
||||||
|
@ -47,10 +48,6 @@ public class DefaultJavaToolchainFactory
|
||||||
@Requirement
|
@Requirement
|
||||||
private Logger logger;
|
private Logger logger;
|
||||||
|
|
||||||
public DefaultJavaToolchainFactory()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public ToolchainPrivate createToolchain( ToolchainModel model )
|
public ToolchainPrivate createToolchain( ToolchainModel model )
|
||||||
throws MisconfiguredToolchainException
|
throws MisconfiguredToolchainException
|
||||||
{
|
{
|
||||||
|
@ -58,7 +55,33 @@ public class DefaultJavaToolchainFactory
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
DefaultJavaToolchain jtc = new DefaultJavaToolchain( model, logger );
|
DefaultJavaToolchain jtc = new DefaultJavaToolchain( model, logger );
|
||||||
|
|
||||||
|
// populate the provides section
|
||||||
|
Properties provides = model.getProvides();
|
||||||
|
for ( Entry<Object, Object> provide : provides.entrySet() )
|
||||||
|
{
|
||||||
|
String key = (String) provide.getKey();
|
||||||
|
String value = (String) provide.getValue();
|
||||||
|
|
||||||
|
if ( value == null )
|
||||||
|
{
|
||||||
|
throw new MisconfiguredToolchainException(
|
||||||
|
"Provides token '" + key + "' doesn't have any value configured." );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( "version".equals( key ) )
|
||||||
|
{
|
||||||
|
jtc.addProvideToken( key, RequirementMatcherFactory.createVersionMatcher( value ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
jtc.addProvideToken( key, RequirementMatcherFactory.createExactMatcher( value ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// populate the configuration section
|
||||||
Xpp3Dom dom = (Xpp3Dom) model.getConfiguration();
|
Xpp3Dom dom = (Xpp3Dom) model.getConfiguration();
|
||||||
Xpp3Dom javahome = dom.getChild( DefaultJavaToolchain.KEY_JAVAHOME );
|
Xpp3Dom javahome = dom.getChild( DefaultJavaToolchain.KEY_JAVAHOME );
|
||||||
if ( javahome == null )
|
if ( javahome == null )
|
||||||
|
@ -77,26 +100,6 @@ public class DefaultJavaToolchainFactory
|
||||||
+ normal.getAbsolutePath() );
|
+ normal.getAbsolutePath() );
|
||||||
}
|
}
|
||||||
|
|
||||||
//now populate the provides section.
|
|
||||||
Properties provides = model.getProvides();
|
|
||||||
for ( Entry<Object, Object> provide : provides.entrySet() )
|
|
||||||
{
|
|
||||||
String key = (String) provide.getKey();
|
|
||||||
String value = (String) provide.getValue();
|
|
||||||
if ( value == null )
|
|
||||||
{
|
|
||||||
throw new MisconfiguredToolchainException(
|
|
||||||
"Provides token '" + key + "' doesn't have any value configured." );
|
|
||||||
}
|
|
||||||
if ( "version".equals( key ) )
|
|
||||||
{
|
|
||||||
jtc.addProvideToken( key, RequirementMatcherFactory.createVersionMatcher( value ) );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
jtc.addProvideToken( key, RequirementMatcherFactory.createExactMatcher( value ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return jtc;
|
return jtc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue