org.apache.ivy.util.DefaultMessageLogger Java Examples
The following examples show how to use
org.apache.ivy.util.DefaultMessageLogger.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: IvyPublishTest.java From ant-ivy with Apache License 2.0 | 6 votes |
@Before public void setUp() { cleanTestDir(); cleanRep(); createCache(); project = TestHelper.newProject(); project.init(); project.setProperty("ivy.settings.file", "test/repositories/ivysettings.xml"); project.setProperty("build", "build/test/publish"); publish = new IvyPublish(); publish.setProject(project); System.setProperty("ivy.cache.dir", cache.getAbsolutePath()); Message.setDefaultLogger(new DefaultMessageLogger(10)); }
Example #2
Source File: DefaultRepositoryCacheManagerTest.java From ant-ivy with Apache License 2.0 | 6 votes |
@Before public void setUp() throws Exception { File f = File.createTempFile("ivycache", ".dir"); ivy = new Ivy(); ivy.configureDefault(); ivy.getLoggerEngine().setDefaultLogger(new DefaultMessageLogger(Message.MSG_DEBUG)); IvyContext.pushNewContext().setIvy(ivy); IvySettings settings = ivy.getSettings(); f.delete(); // we want to use the file as a directory, so we delete the file itself cacheManager = new DefaultRepositoryCacheManager(); cacheManager.setSettings(settings); cacheManager.setBasedir(f); artifact = createArtifact("org", "module", "rev", "name", "type", "ext"); Artifact originArtifact = createArtifact("org", "module", "rev", "name", "pom.original", "pom"); origin = new ArtifactOrigin(originArtifact, true, "file:/some/where.pom"); cacheManager.saveArtifactOrigin(originArtifact, origin); cacheManager.saveArtifactOrigin(artifact, origin); }
Example #3
Source File: PackagerResolverTest.java From ant-ivy with Apache License 2.0 | 6 votes |
@Before public void setUp() throws Exception { Message.setDefaultLogger(new DefaultMessageLogger(99)); settings = new IvySettings(); ResolveEngine engine = new ResolveEngine(settings, new EventManager(), new SortEngine( settings)); cache = new File("build/cache"); data = new ResolveData(engine, new ResolveOptions()); cache.mkdirs(); settings.setDefaultCache(cache); // Create work space with build and resource cache directories workdir = new File("build/test/PackagerResolverTest"); builddir = new File(workdir, "build"); cachedir = new File(workdir, "resources"); cleanupTempDirs(); if (!builddir.mkdirs() || !cachedir.mkdirs()) { throw new Exception("can't create directories under " + workdir); } }
Example #4
Source File: Main.java From ant-ivy with Apache License 2.0 | 5 votes |
private static void initMessage(CommandLine line, Ivy ivy) { if (line.hasOption("debug")) { ivy.getLoggerEngine().pushLogger(new DefaultMessageLogger(Message.MSG_DEBUG)); } else if (line.hasOption("verbose")) { ivy.getLoggerEngine().pushLogger(new DefaultMessageLogger(Message.MSG_VERBOSE)); } else if (line.hasOption("warn")) { ivy.getLoggerEngine().pushLogger(new DefaultMessageLogger(Message.MSG_WARN)); } else if (line.hasOption("error")) { ivy.getLoggerEngine().pushLogger(new DefaultMessageLogger(Message.MSG_ERR)); } else { ivy.getLoggerEngine().pushLogger(new DefaultMessageLogger(Message.MSG_INFO)); } }
Example #5
Source File: OSGiManifestParserTest.java From ant-ivy with Apache License 2.0 | 5 votes |
@Before public void setUp() { Message.setDefaultLogger(new DefaultMessageLogger(Message.MSG_WARN)); settings = new IvySettings(); // prevent test from polluting local cache settings.setDefaultCache(new File("build/cache")); }
Example #6
Source File: RetrieveTest.java From ant-ivy with Apache License 2.0 | 5 votes |
@Before public void setUp() throws Exception { ivy = Ivy.newInstance(); ivy.configure(new File("test/repositories/ivysettings.xml")); TestHelper.createCache(); Message.setDefaultLogger(new DefaultMessageLogger(Message.MSG_INFO)); }
Example #7
Source File: XmlModuleDescriptorParserTest.java From ant-ivy with Apache License 2.0 | 5 votes |
@Before public void setUp() { Message.setDefaultLogger(new DefaultMessageLogger(Message.MSG_WARN)); this.settings = new IvySettings(); // prevent test from polluting local cache settings.setDefaultCache(new File("build/cache")); }
Example #8
Source File: DependenciesManager.java From restcommander with Apache License 2.0 | 5 votes |
public Ivy configure() throws Exception { boolean verbose = System.getProperty("verbose") != null; boolean debug = System.getProperty("debug") != null; HumanReadyLogger humanReadyLogger = new HumanReadyLogger(); IvySettings ivySettings = new IvySettings(); new SettingsParser(humanReadyLogger).parse(ivySettings, new File(framework, "framework/dependencies.yml")); new SettingsParser(humanReadyLogger).parse(ivySettings, new File(application, "conf/dependencies.yml")); ivySettings.setDefaultResolver("mavenCentral"); ivySettings.setDefaultUseOrigin(true); PlayConflictManager conflictManager = new PlayConflictManager(); ivySettings.addConflictManager("playConflicts", conflictManager); ivySettings.addConflictManager("defaultConflicts", conflictManager.deleguate); ivySettings.setDefaultConflictManager(conflictManager); Ivy ivy = Ivy.newInstance(ivySettings); // Default ivy config see: http://play.lighthouseapp.com/projects/57987-play-framework/tickets/807 File ivyDefaultSettings = new File(userHome, ".ivy2/ivysettings.xml"); if(ivyDefaultSettings.exists()) { ivy.configure(ivyDefaultSettings); } if (debug) { ivy.getLoggerEngine().pushLogger(new DefaultMessageLogger(Message.MSG_DEBUG)); } else if (verbose) { ivy.getLoggerEngine().pushLogger(new DefaultMessageLogger(Message.MSG_INFO)); } else { logger = humanReadyLogger; ivy.getLoggerEngine().setDefaultLogger(logger); } ivy.pushContext(); return ivy; }
Example #9
Source File: IvyConfigurationProvider.java From walkmod-core with GNU Lesser General Public License v3.0 | 5 votes |
private void applyVerbose() { if(verbose) { Message.setDefaultLogger(new DefaultMessageLogger(Message.MSG_INFO)); } else { Message.setDefaultLogger(new DefaultMessageLogger(Message.MSG_ERR)); } }
Example #10
Source File: IvyConfigurationProvider.java From walkmod-core with GNU Lesser General Public License v3.0 | 5 votes |
private void applyVerbose() { if(verbose) { Message.setDefaultLogger(new DefaultMessageLogger(Message.MSG_INFO)); } else { Message.setDefaultLogger(new DefaultMessageLogger(Message.MSG_ERR)); } }
Example #11
Source File: SampleIvyRunner.java From jeka with Apache License 2.0 | 4 votes |
public void retrieve() { final IBiblioResolver dependencyResolver = new IBiblioResolver(); dependencyResolver .setRoot("http://i-net1102e-prod:8081/nexus/content/groups/bnppf-secured"); dependencyResolver.setM2compatible(true); dependencyResolver.setUseMavenMetadata(true); dependencyResolver.setName("nexus"); // Name is necessary to avoid NPE final IvySettings ivySettings = new IvySettings(); ivySettings.addResolver(dependencyResolver); ivySettings.setDefaultResolver("nexus"); // Setting a default resolver // is necessary final Ivy ivy = Ivy.newInstance(ivySettings); ivy.getLoggerEngine().setDefaultLogger(new DefaultMessageLogger(Message.MSG_DEBUG)); final ModuleRevisionId thisModuleRevisionId = ModuleRevisionId.newInstance("mygroupId", "myartifactId-envelope", "myversion"); final ModuleRevisionId dependee = ModuleRevisionId.newInstance("org.springframework", "spring-jdbc", "3.0.0.RELEASE"); // final ModuleRevisionId dependee = // ModuleRevisionId.newInstance("org.hibernate", // "hibernate-core", "3.6.10.Final"); // 1st create an ivy module (this always(!) has a "default" // configuration already) final DefaultModuleDescriptor moduleDescriptor = DefaultModuleDescriptor .newDefaultInstance(thisModuleRevisionId); // don't go transitive here, if you want the single artifact final boolean transitive = true; final DefaultDependencyDescriptor dependencyDescriptor = new DefaultDependencyDescriptor( moduleDescriptor, dependee, false, false, transitive); // map to master to just get the code jar. See generated ivy module xmls // from maven repo // on how configurations are mapped into ivy. Or check // e.g. // http://lightguard-jp.blogspot.de/2009/04/ivy-configurations-when-pulling-from.html // dependencyDescriptor.addDependencyConfiguration("default", "master"); // To get more than 1 artifact i need to declare "compile" and not // "master" dependencyDescriptor.addDependencyConfiguration("default", "compile"); moduleDescriptor.addDependency(dependencyDescriptor); // now resolve final ResolveOptions resolveOptions = new ResolveOptions() .setConfs(new String[] { "default" }); resolveOptions.setTransitive(transitive); ResolveReport reportResolver; try { reportResolver = ivy.resolve(moduleDescriptor, resolveOptions); } catch (final Exception e1) { throw new RuntimeException(e1); } if (reportResolver.hasError()) { System.out .println("*************************************************************************"); System.out.println(reportResolver); throw new RuntimeException(reportResolver.getAllProblemMessages().toString()); } for (final ArtifactDownloadReport artifactDownloadReport : reportResolver .getAllArtifactsReports()) { System.out.println("*********************************" + artifactDownloadReport.getLocalFile()); } final String filePattern = new File("jeka/output/downloaded-libs").getAbsolutePath() + "/[artifact](-[classifier]).[ext]"; final RetrieveOptions retrieveOptions = new RetrieveOptions() .setConfs(new String[] { "default" }); try { ivy.retrieve(moduleDescriptor.getModuleRevisionId(), filePattern, retrieveOptions); } catch (final IOException e) { throw new RuntimeException(e); } }
Example #12
Source File: XmlModuleDescriptorParserTest.java From ant-ivy with Apache License 2.0 | 4 votes |
@Test public void testExtendsAll() throws Exception { Message.setDefaultLogger(new DefaultMessageLogger(99)); // default extends type is 'all' when no extendsType attribute is specified. ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(settings, getClass().getResource("test-extends-all.xml"), true); assertNotNull(md); assertEquals("myorg", md.getModuleRevisionId().getOrganisation()); assertEquals("mymodule", md.getModuleRevisionId().getName()); assertEquals("myrev", md.getModuleRevisionId().getRevision()); assertEquals("integration", md.getStatus()); // verify that the parent description was merged. assertEquals("Parent module description.", md.getDescription()); // verify that the parent and child configurations were merged together. final Configuration[] expectedConfs = {new Configuration("default"), new Configuration("conf1"), new Configuration("conf2")}; assertNotNull(md.getConfigurations()); assertEquals(Arrays.asList(expectedConfs), Arrays.asList(md.getConfigurations())); // verify parent and child dependencies were merged together. DependencyDescriptor[] deps = md.getDependencies(); assertNotNull(deps); assertEquals(2, deps.length); assertEquals(Collections.singletonList("default"), Arrays.asList(deps[0].getModuleConfigurations())); ModuleRevisionId dep = deps[0].getDependencyRevisionId(); assertEquals("myorg", dep.getModuleId().getOrganisation()); assertEquals("mymodule1", dep.getModuleId().getName()); assertEquals("1.0", dep.getRevision()); assertEquals(Arrays.asList("conf1", "conf2"), Arrays.asList(deps[1].getModuleConfigurations())); dep = deps[1].getDependencyRevisionId(); assertEquals("myorg", dep.getModuleId().getOrganisation()); assertEquals("mymodule2", dep.getModuleId().getName()); assertEquals("2.0", dep.getRevision()); // verify only child publications are present Artifact[] artifacts = md.getAllArtifacts(); assertNotNull(artifacts); assertEquals(1, artifacts.length); assertEquals("mymodule", artifacts[0].getName()); assertEquals("jar", artifacts[0].getType()); }
Example #13
Source File: MavenResolver.java From IJava with MIT License | 3 votes |
/** * Create an ivy instance with the specified verbosity. The instance is relatively plain. * * @param verbosity the verbosity level. * <ol start="0"> * <li>ERROR</li> * <li>WANRING</li> * <li>INFO</li> * <li>VERBOSE</li> * <li>DEBUG</li> * </ol> * * @return the fresh ivy instance. */ private Ivy createDefaultIvyInstance(int verbosity) { MessageLogger logger = new DefaultMessageLogger(verbosity); // Set the default logger since not all things log to the ivy instance. Message.setDefaultLogger(logger); Ivy ivy = new Ivy(); ivy.getLoggerEngine().setDefaultLogger(logger); ivy.setSettings(new IvySettings()); ivy.bind(); return ivy; }