Code example for File

Methods: getAbsoluteFile

        eps.setProperty( "jre.home", new File( pom.getParentFile(), "jdk/jre" ).getPath() );        
        MavenSession session = createMavenSession( pom, eps );
        MavenProject project = session.getCurrentProject();
        // Here we will actually not have any artifacts because the ProjectDependenciesResolver is not involved here. So 
        // right now it's not valid to ask for artifacts unless plugins require the artifacts. 
    public void testBuildFromModelSource() 
        throws Exception 
        File pomFile = new File( "src/test/resources/projects/modelsource/module01/pom.xml" );
        MavenSession mavenSession = createMavenSession( pomFile );
        ProjectBuildingRequest configuration = new DefaultProjectBuildingRequest();
        configuration.setRepositorySession( mavenSession.getRepositorySession() );
        ModelSource modelSource = new FileModelSource( pomFile );
        ProjectBuildingResult result =
            lookup( org.apache.maven.project.ProjectBuilder.class ).build( modelSource, configuration );
Experience pair programming with AI  Get Codota for Java