Package org.apache.maven.model

Examples of org.apache.maven.model.Build


        Set<Artifact> allArtifacts = new HashSet<Artifact>();
        allArtifacts.add(coreResources);
        allArtifacts.add(siteResources);

        String buildDirectory = "target";
        Build build = new Build();
        build.setDirectory(buildDirectory);

        UnArchiver coreArchiver = mock(UnArchiver.class);
        UnArchiver siteArchiver = mock(UnArchiver.class);

        // When
View Full Code Here


        Set<Artifact> allArtifacts = new HashSet<Artifact>();
        allArtifacts.add(someResources);

        String buildDirectory = "target";
        Build build = new Build();
        build.setDirectory(buildDirectory);

        // When
        mojo.project = project;
        mojo.archiverManager = archiveManager;
        mojo.resourceIncludes = "ftl/*";
 
View Full Code Here

        Set<Artifact> allArtifacts = new HashSet<Artifact>();
        allArtifacts.add(coreResources);
        allArtifacts.add(siteResources);

        String buildDirectory = "target";
        Build build = new Build();
        build.setDirectory(buildDirectory);

        UnArchiver coreArchiver = mock(UnArchiver.class);
        UnArchiver siteArchiver = mock(UnArchiver.class);

        // When
View Full Code Here

    protected void copyFileToDirectory(String from, String to) throws Exception {
        FileUtils.copyFileToDirectory(getTestFile(from), getTestFile(to));
    }

    protected MavenProject getMavenProject() {
        final Build build = new Build();
        build.setDirectory("target");
        build.setOutputDirectory("target/classes");
        build.setTestOutputDirectory("target/test-classes");

        return new MavenProjectStub() {
            String daoFramework = "hibernate";
            String webFramework = "struts";
            Properties props;
View Full Code Here

        Assert.assertEquals(1, downstream.size());
        Assert.assertSame(this.module, downstream.get(0));
    }

    private static void addModuleAsPluginDependency(MavenModule module, MavenModule pluginModule) {
        Build build = new Build();
        Plugin plugin = new Plugin();
        plugin.setGroupId(pluginModule.getModuleName().groupId);
        plugin.setArtifactId(pluginModule.getModuleName().artifactId);
        plugin.setVersion(pluginModule.getVersion());
        build.setPlugins(Collections.singletonList(plugin));
       
        MavenProject project = new MavenProject();
        project.setGroupId(module.getModuleName().groupId);
        project.setArtifactId(module.getModuleName().artifactId);
        project.setVersion(module.getVersion());
View Full Code Here

   }

   private List<org.apache.maven.model.Plugin> getPluginsPOM(boolean managedPlugin, boolean effectivePlugin)
   {
      MavenCoreFacet mavenCoreFacet = project.getFacet(MavenCoreFacet.class);
      Build build = null;
      if (effectivePlugin)
      {
         build = mavenCoreFacet.getMavenProject().getBuild();
      }
      else
      {
         build = mavenCoreFacet.getPOM().getBuild();
      }
      if (build != null)
      {
         if (managedPlugin)
         {
            PluginManagement pluginManagement = build.getPluginManagement();
            if (pluginManagement != null)
            {
               return pluginManagement.getPlugins();
            }
         }
         else
         {
            return build.getPlugins();
         }
      }
      return Collections.emptyList();
   }
View Full Code Here

   private void addPlugin(final MavenPlugin plugin, boolean managedPlugin)
   {
      MavenCoreFacet mavenCoreFacet = project.getFacet(MavenCoreFacet.class);
      Model pom = mavenCoreFacet.getPOM();
      Build build = pom.getBuild();
      if (build == null)
         build = new Build();
      if (managedPlugin)
      {
         PluginManagement pluginManagement = build.getPluginManagement();
         if (pluginManagement == null)
         {
            pluginManagement = new PluginManagement();
            build.setPluginManagement(pluginManagement);
         }
         pluginManagement.addPlugin(new MavenPluginAdapter(plugin));
      }
      else
      {
         build.addPlugin(new MavenPluginAdapter(plugin));
      }
      pom.setBuild(build);
      mavenCoreFacet.setPOM(pom);
   }
View Full Code Here

      // Remove if it exists
      if (pluginToRemove != null)
      {
         MavenCoreFacet mavenCoreFacet = project.getFacet(MavenCoreFacet.class);
         Model pom = mavenCoreFacet.getPOM();
         Build build = pom.getBuild(); // We know for sure it isnt null because the plugin exists
         if (managedPlugin)
         {
            PluginManagement pluginManagement = build.getPluginManagement(); // We know for sure it isnt null because
                                                                             // the plugin exists
            pluginManagement.removePlugin(new MavenPluginAdapter(pluginToRemove));
         }
         else
         {
            build.removePlugin(new MavenPluginAdapter(pluginToRemove));
         }
         pom.setBuild(build);
         mavenCoreFacet.setPOM(pom);
      }
   }
View Full Code Here

        assertEquals( basedirFile.getCanonicalPath(), sourceDirectoryFile.getCanonicalPath().substring( 0, getBasedir().length() ) );

        assertEquals( basedirFile.getCanonicalPath(), testSourceDirectoryFile.getCanonicalPath().substring( 0, getBasedir().length() ) );

        Build build = project.getBuild();

        Resource resource = (Resource) build.getResources().get( 0 );

        assertTrue( resource.getDirectory().startsWith( getBasedir() ) );
    }
View Full Code Here

     {
         File pom = getTestFile( "src/test/resources/projects/build-path-expression-pom.xml" );

         MavenProject project = getProject( pom );

         Build build = project.getBuild();
         assertNotNull( "Project should have a build section containing the test resource.", build );

         String sourceDirectory = build.getSourceDirectory();
         assertNotNull( "Project build should contain a valid source directory.", sourceDirectory );

         List resources = build.getResources();
         assertNotNull( "Project should contain a build resource.", resources );
         assertEquals( "Project should contain exactly one build resource.", 1, resources.size() );

         Resource res = (Resource) resources.get( 0 );
         assertEquals( "Project resource should be the same directory as the source directory.", sourceDirectory, res.getDirectory() );
View Full Code Here

TOP

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

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.