本文整理汇总了Java中org.apache.maven.model.Profile.getId方法的典型用法代码示例。如果您正苦于以下问题:Java Profile.getId方法的具体用法?Java Profile.getId怎么用?Java Profile.getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.maven.model.Profile
的用法示例。
在下文中一共展示了Profile.getId方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addProfile
import org.apache.maven.model.Profile; //导入方法依赖的package包/类
public void addProfile( Profile profile )
{
String profileId = profile.getId();
Profile existing = (Profile) profilesById.get( profileId );
if ( existing != null )
{
logger.warn( "Overriding profile: \'" + profileId + "\' (source: " + existing.getSource()
+ ") with new instance from source: " + profile.getSource() );
}
profilesById.put( profile.getId(), profile );
Activation activation = profile.getActivation();
if ( activation != null && activation.isActiveByDefault() )
{
activateAsDefault( profileId );
}
}
示例2: addProfile
import org.apache.maven.model.Profile; //导入方法依赖的package包/类
public MavenExecutionRequest addProfile( Profile profile )
{
if ( profile == null )
{
throw new IllegalArgumentException( "profile missing" );
}
for ( Profile p : getProfiles() )
{
if ( p.getId() != null && p.getId().equals( profile.getId() ) )
{
return this;
}
}
getProfiles().add( profile );
return this;
}
示例3: provideActiveProfiles
import org.apache.maven.model.Profile; //导入方法依赖的package包/类
private void provideActiveProfiles(final Properties buildMetaDataProperties)
{
final List<Profile> profiles = getActiveProfiles();
if (profiles != null && !profiles.isEmpty())
{
final List<String> profileIds = new ArrayList<String>(profiles.size());
for (final Profile profile : profiles)
{
final String profileId = profile.getId();
if (!profileIds.contains(profileId))
{
final String key =
Constant.MAVEN_ACTIVE_PROFILE_PREFIX + '.' + profileId;
final String value = profile.getSource();
buildMetaDataProperties.setProperty(key, value);
profileIds.add(profileId);
}
}
buildMetaDataProperties.setProperty(
Constant.PROP_NAME_MAVEN_ACTIVE_PROFILES,
MojoUtils.toPrettyString(profileIds));
}
}
示例4: collectProfilesIds
import org.apache.maven.model.Profile; //导入方法依赖的package包/类
private static Collection<String> collectProfilesIds(List<Profile> profiles) {
Collection<String> result = new THashSet<String>();
for (Profile each : profiles) {
if (each.getId() != null) {
result.add(each.getId());
}
}
return result;
}
示例5: convertProfiles
import org.apache.maven.model.Profile; //导入方法依赖的package包/类
private static List<MavenProfile> convertProfiles(List<Profile> profiles, File projectDir) {
List<MavenProfile> result = new ArrayList<>();
if (profiles != null) {
for (Profile profile : profiles) {
if (profile.getId() == null) {
continue;
}
MavenProfile mavenProfile = new MavenProfile(profile.getId(), profile.getSource());
List<String> modules = profile.getModules();
if (modules == null) {
mavenProfile.setModules(Collections.emptyList());
} else {
mavenProfile.setModules(modules);
}
mavenProfile.setActivation(convertActivation(profile.getActivation()));
if (profile.getBuild() != null) {
convertBaseBuild(profile.getBuild(), mavenProfile.getBuild(), projectDir);
}
result.add(mavenProfile);
}
}
return result;
}
示例6: collectProfilesIds
import org.apache.maven.model.Profile; //导入方法依赖的package包/类
private static Collection<String> collectProfilesIds(List<Profile> profiles) {
Collection<String> result = new HashSet<>();
for (Profile each : profiles) {
if (each.getId() != null) {
result.add(each.getId());
}
}
return result;
}
示例7: isActive
import org.apache.maven.model.Profile; //导入方法依赖的package包/类
public boolean isActive( Profile profile )
throws ProfileActivationException
{
Activation activation = profile.getActivation();
String jdk = activation.getJdk();
// null case is covered by canDetermineActivation(), so we can do a straight startsWith() here.
if ( jdk.startsWith( "[" ) || jdk.startsWith( "(" ) )
{
try
{
return matchJdkVersionRange( jdk );
}
catch ( InvalidVersionSpecificationException e )
{
throw new ProfileActivationException( "Invalid JDK version in profile '" + profile.getId() + "': "
+ e.getMessage() );
}
}
boolean reverse = false;
if ( jdk.startsWith( "!" ) )
{
reverse = true;
jdk = jdk.substring( 1 );
}
if ( getJdkVersion().startsWith( jdk ) )
{
return !reverse;
}
else
{
return reverse;
}
}
示例8: beforeProjectLifecycleExecution
import org.apache.maven.model.Profile; //导入方法依赖的package包/类
@Override
public void beforeProjectLifecycleExecution(ProjectExecutionEvent event) throws LifecycleExecutionException {
final MavenProject project = event.getProject();
log.info("srcdeps enforcer checks for violations in {}:{}", project.getGroupId(), project.getArtifactId());
final Maven maven = configurationProducer.getConfiguration().getMaven();
final List<MojoExecution> mojoExecutions = event.getExecutionPlan();
final List<String> goals = new ArrayList<>(mojoExecutions.size());
for (MojoExecution mojoExecution : mojoExecutions) {
MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
goals.add(mojoDescriptor.getFullGoalName());
goals.add(mojoDescriptor.getGoal());
}
final List<String> profiles = new ArrayList<>();
final List<Profile> activeProfiles = project.getActiveProfiles();
for (Profile profile : activeProfiles) {
final String id = profile.getId();
profiles.add(id);
}
final Properties props = new Properties();
props.putAll(project.getProperties());
props.putAll(System.getProperties());
String[] firstViolation = assertFailWithout(maven.getFailWithout(), goals, profiles, props);
if (firstViolation == null) {
firstViolation = assertFailWith(maven.getFailWith(), goals, profiles, props);
}
if (firstViolation != null) {
/* check if there are srcdeps */
Artifact parent = project.getParentArtifact();
if (parent != null) {
assertNotSrcdeps(parent.getGroupId(), parent.getArtifactId(), parent.getVersion(), firstViolation);
}
DependencyManagement dm;
List<Dependency> deps;
if ((dm = project.getDependencyManagement()) != null && (deps = dm.getDependencies()) != null) {
assertNotSrcdeps(deps, firstViolation);
}
if ((deps = project.getDependencies()) != null) {
assertNotSrcdeps(deps, firstViolation);
}
}
}