@Test public void testInlineProperty() throws Exception { final File projectroot = new File( TestUtils.resolveFileResource( RESOURCE_BASE, "/" ) .getParentFile() .getParentFile() .getParentFile() .getParentFile(), "pom.xml" ); PomIO pomIO = new PomIO(); FileIO fileIO = new FileIO( new GalleyInfrastructure( null, null ).init( temporaryFolder.newFolder() ) ); List<Project> projects = pomIO.parseProject( projectroot ); ManipulationSession ms = TestUtils.createSession( null ); Project root = projects.stream() .filter( p -> p.getProjectParent() == null ) .findAny() .orElseThrow( Exception::new ); logger.info( "Found project root {}", root ); BaseScript bs = new BaseScript() { @Override public Object run() { return null; } }; bs.setValues( pomIO, fileIO, null, ms, projects, root, null ); bs.inlineProperty( root, SimpleProjectRef.parse( "org.commonjava.maven.atlas:atlas-identities" ) ); bs.inlineProperty( root, SimpleProjectRef.parse( "org.commonjava.maven.galley:*" ) ); try { bs.getFileIO().resolveURL( "http: fail ("No exception"); } catch ( IOException e ) { if ( !( e instanceof UnknownHostException )) { fail ("Unknown exception " + e); } } assertEquals( "0.17.1", root.getModel() .getDependencyManagement() .getDependencies() .stream() .filter( d -> d.getArtifactId().equals( "atlas-identities" ) ) .findFirst() .orElseThrow(Exception::new) .getVersion() ); assertEquals( 5, root.getModel() .getDependencyManagement() .getDependencies() .stream() .filter( d -> d.getGroupId().equals( "org.commonjava.maven.galley" ) ) .filter( d -> d.getVersion().equals( "0.16.6" ) ) .count() ); bs.inlineProperty( root, "jacksonVersion" ); assertFalse( root.getModel() .getDependencyManagement() .getDependencies() .stream() .filter( d -> d.getArtifactId().equals( "jackson-databind" ) ) .findFirst() .orElseThrow(Exception::new) .getVersion() .contains( "$" ) ); }
public void setValues(PomIO pomIO, FileIO fileIO, ModelIO modelIO, ManipulationSession session, List<Project> projects, Project project, InvocationStage stage) { this.fileIO = fileIO; this.pomIO = pomIO; this.modelIO = modelIO; this.sessionHandler = session; this.projects = projects; this.project = project; this.gav = project.getKey(); this.basedir = project.getPom().getParentFile(); this.userProperties = session.getUserProperties(); this.stage = stage; logger.info ("Injecting values. Project is " + project + " with basedir " + basedir + " and properties " + userProperties); }
BaseScript extends BaseScriptUtils { public void setValues(PomIO pomIO, FileIO fileIO, ModelIO modelIO, ManipulationSession session, List<Project> projects, Project project, InvocationStage stage) { this.fileIO = fileIO; this.pomIO = pomIO; this.modelIO = modelIO; this.sessionHandler = session; this.projects = projects; this.project = project; this.gav = project.getKey(); this.basedir = project.getPom().getParentFile(); this.userProperties = session.getUserProperties(); this.stage = stage; logger.info ("Injecting values. Project is " + project + " with basedir " + basedir + " and properties " + userProperties); } }
BaseScript extends BaseScriptUtils { public void setValues(PomIO pomIO, FileIO fileIO, ModelIO modelIO, ManipulationSession session, List<Project> projects, Project project, InvocationStage stage) { this.fileIO = fileIO; this.pomIO = pomIO; this.modelIO = modelIO; this.sessionHandler = session; this.projects = projects; this.project = project; this.gav = project.getKey(); this.basedir = project.getPom().getParentFile(); this.userProperties = session.getUserProperties(); this.stage = stage; logger.info ("Injecting values. Project is " + project + " with basedir " + basedir + " and properties " + userProperties); }  }
BaseScript extends BaseScriptUtils { public void setValues(PomIO pomIO, FileIO fileIO, ModelIO modelIO, ManipulationSession session, List<Project> projects, Project project, InvocationStage stage) { this.fileIO = fileIO; this.pomIO = pomIO; this.modelIO = modelIO; this.sessionHandler = session; this.projects = projects; this.project = project; this.gav = project.getKey(); this.basedir = project.getPom().getParentFile(); this.userProperties = session.getUserProperties(); this.stage = stage; logger.info ("Injecting values. Project is " + project + " with basedir " + basedir + " and properties " + userProperties); }  Project getProject(); List<Project> getProjects(); ProjectVersionRef getGAV(); File getBaseDir(); Properties getUserProperties(); MavenSessionHandler getSession(); InvocationStage getInvocationStage(); void setValues(PomIO pomIO, FileIO fileIO, ModelIO modelIO, ManipulationSession session, List<Project> projects, Project project,
                          InvocationStage stage); }
BaseScript extends BaseScriptUtils { public void setValues(PomIO pomIO, FileIO fileIO, ModelIO modelIO, ManipulationSession session, List<Project> projects, Project project, InvocationStage stage) { this.fileIO = fileIO; this.pomIO = pomIO; this.modelIO = modelIO; this.sessionHandler = session; this.projects = projects; this.project = project; this.gav = project.getKey(); this.basedir = project.getPom().getParentFile(); this.userProperties = session.getUserProperties(); this.stage = stage; logger.info ("Injecting values. Project is " + project + " with basedir " + basedir + " and properties " + userProperties); }  Project getProject(); List<Project> getProjects(); ProjectVersionRef getGAV(); File getBaseDir(); Properties getUserProperties(); MavenSessionHandler getSession(); InvocationStage getInvocationStage(); void setValues(PomIO pomIO, FileIO fileIO, ModelIO modelIO, ManipulationSession session, List<Project> projects, Project project,
                          InvocationStage stage);  }