Package org.apache.maven.model

Examples of org.apache.maven.model.Profile


               .addDependency(
                        DependencyBuilder.create("org.jboss.arquillian.protocol:arquillian-protocol-servlet"))
               .addDependency(DependencyBuilder.create("org.jboss.jsfunit:jsfunit-arquillian:2.0.0.Beta2"))
               .addDependency(DependencyBuilder.create("org.jboss.as:jboss-as-arquillian-container-managed:7.1.0.CR1b"));

      Profile profile = profileBuilder.getAsMavenProfile();

      Build build = new Build();

      Plugin plugin = new Plugin();
      plugin.setArtifactId("maven-dependency-plugin");
      plugin.setExtensions(false);

      PluginExecution execution = new PluginExecution();
      execution.setId("unpack");
      execution.setPhase("process-test-classes");
      execution.addGoal("unpack");

      ConfigurationBuilder configBuilder = ConfigurationBuilder.create();
      ConfigurationElementBuilder artifactItem = configBuilder
               .createConfigurationElement("artifactItems").addChild("artifactItem");
      artifactItem.addChild("groupId").setText("org.jboss.as");
      artifactItem.addChild("artifactId").setText("jboss-as-dist");
      artifactItem.addChild("version").setText("7.1.0.CR1b");
      artifactItem.addChild("type").setText("zip");
      artifactItem.addChild("outputDirectory").setText("target/");
      try {
         new Xpp3DomBuilder();
         execution.setConfiguration(
                  Xpp3DomBuilder.build(new ByteArrayInputStream(configBuilder.toString().getBytes()), "UTF-8"));
      }
      catch (XmlPullParserException e) {
         throw new RuntimeException(e);
      }
      catch (IOException e) {
         throw new RuntimeException(e);
      }

      plugin.addExecution(execution);

      build.addPlugin(plugin);
      profile.setBuild(build);
      Model pom = mvn.getPOM();
      pom.addProfile(profile);
      mvn.setPOM(pom);
   }
View Full Code Here


        ProjectBuildingRequest config = new DefaultProjectBuildingRequest();

        for ( org.apache.maven.settings.Profile rawProfile : settings.getProfiles() )
        {
            Profile profile = SettingsUtils.convertFromSettingsProfile( rawProfile );
            config.addProfile( profile );
        }

        String localRepoUrl =
            System.getProperty( "maven.repo.local", System.getProperty( "user.home" ) + "/.m2/repository" );
View Full Code Here

    */
    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 );

View Full Code Here

     */
    public void addProfiles( List profiles )
    {
        for ( Iterator it = profiles.iterator(); it.hasNext(); )
        {
            Profile profile = (Profile) it.next();

            addProfile( profile );
        }
    }
View Full Code Here

            }
        }

        for ( Iterator itp = project.getOriginalModel().getProfiles().iterator(); itp.hasNext(); )
        {
            Profile profile = (Profile) itp.next();
            for ( Iterator it = profile.getDependencies().iterator(); it.hasNext(); )
            {
                Dependency dependency = (Dependency) it.next();
                if ( managementKey.equals( dependency.getManagementKey() ) )
                {
                    return dependency.getSystemPath();
View Full Code Here

                elIt = null;
            }
            Counter innerCount = new Counter( counter.getDepth() + 1 );
            while ( it.hasNext() )
            {
                Profile value = (Profile) it.next();
                Element el;
                if ( elIt != null && elIt.hasNext() )
                {
                    el = (Element) elIt.next();
                    if ( !elIt.hasNext() )
View Full Code Here

  private void addTestResources(final Project project) {
    final MavenFacet mavenFacet = project.getFacet(MavenFacet.class);

    final Model pom = mavenFacet.getModel();
    final Map<String, Resource> resourcesByDirectory = new HashMap<String, Resource>();
    final Profile testProfile = MavenModelUtil.getProfileById("integration-test", pom.getProfiles());
   
    addTestResourcesFromMainBuild(pom, resourcesByDirectory);
    addTestResourcesFromTestProfile(resourcesByDirectory, testProfile);
    maybeAddTestSourceDirectory(pom, resourcesByDirectory);
   
    testProfile.getBuild().setTestResources(new ArrayList<Resource>(resourcesByDirectory.values()));
    mavenFacet.setModel(pom);
  }
View Full Code Here

  public boolean install() {
    if (super.install()) {
      // Set main profile to be active by default
      final MavenFacet coreFacet = getProject().getFacet(MavenFacet.class);
      final Model pom = coreFacet.getModel();
      Profile profile = MavenModelUtil.getProfileById(MAIN_PROFILE, pom.getProfiles());
      if (profile == null) {
        profile = new Profile();
        profile.setId(MAIN_PROFILE);
        pom.addProfile(profile);
      }
      if (profile.getActivation() == null)
        profile.setActivation(new Activation());
      profile.getActivation().setActiveByDefault(true);
      coreFacet.setModel(pom);

      return true;
    }
    else {
View Full Code Here

  protected boolean addDependenciesToProfile(final String name, final Collection<DependencyBuilder> deps,
          final VersionOracle versionOracle) {
    final MavenFacet coreFacet = getProject().getFacet(MavenFacet.class);
    final Model pom = coreFacet.getModel();

    Profile profile = MavenModelUtil.getProfileById(name, pom.getProfiles());

    if (profile == null) {
      profile = new Profile();
      profile.setId(name);
      pom.addProfile(profile);
    }

    for (DependencyBuilder dep : deps) {
      if (!hasDependency(profile, dep)) {
        if (!versionOracle.isManaged(dep)) {
          if (dep.getCoordinate().getVersion() == null || dep.getCoordinate().getVersion().equals("")) {
            if (dep.getGroupId().equals(ArtifactVault.ERRAI_GROUP_ID))
              dep.setVersion(Property.ErraiVersion.invoke());
            else
              dep.setVersion(versionOracle.resolveVersion(dep.getGroupId(), dep.getCoordinate().getArtifactId()));
          }
        }
        profile.addDependency(MavenConverter.convert(dep));
      }
    }

    coreFacet.setModel(pom);
View Full Code Here

    }

    final Model pom = coreFacet.getModel();
    final Map<String, Collection<DependencyBuilder>> blacklistProfileDependencies = new HashMap<String, Collection<DependencyBuilder>>();
    for (String profileId : ArtifactVault.getBlacklistProfiles()) {
      final Profile profile = MavenModelUtil.getProfileById(profileId, pom.getProfiles());
      for (final DependencyArtifact artifact : ArtifactVault.getBlacklistedArtifacts(profileId)) {
        final DependencyBuilder dep = getDependency(artifact);
        if (depFacet.hasEffectiveDependency(dep)
                && !hasProvidedDependency(profile, dep)) {
          final org.jboss.forge.addon.dependencies.Dependency existing = depFacet.getEffectiveDependency(dep);
View Full Code Here

TOP

Related Classes of org.apache.maven.model.Profile

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.