Examples of IvySettings


Examples of org.apache.ivy.core.settings.IvySettings

        assertEquals(expected, wrote);
    }

    public void testExtraInfos() throws Exception {
        ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(
            new IvySettings(),
            XmlModuleDescriptorWriterTest.class.getResource("test-extrainfo.xml"), false);
        XmlModuleDescriptorWriter.write(md, LICENSE, dest);

        assertTrue(dest.exists());
        String wrote = FileUtil.readEntirely(new BufferedReader(new FileReader(dest)))
View Full Code Here

Examples of org.apache.ivy.core.settings.IvySettings

        assertEquals(expected, wrote);
    }

    public void testExtraInfosWithNestedElement() throws Exception {
        ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(
            new IvySettings(),
            XmlModuleDescriptorWriterTest.class.getResource("test-extrainfo-nested.xml"), false);
        XmlModuleDescriptorWriter.write(md, LICENSE, dest);

        assertTrue(dest.exists());
        String wrote = FileUtil.readEntirely(new BufferedReader(new FileReader(dest)))
View Full Code Here

Examples of org.apache.ivy.core.settings.IvySettings

        assertEquals(expected, wrote);
    }

    public void testExtends() throws Exception {
        ModuleDescriptor md = XmlModuleDescriptorParser.getInstance().parseDescriptor(
            new IvySettings(),
            XmlModuleDescriptorWriterTest.class.getResource("test-extends-all.xml"), false);
        XmlModuleDescriptorWriter.write(md, LICENSE, dest);

        assertTrue(dest.exists());
        String wrote = FileUtil.readEntirely(new BufferedReader(new FileReader(dest))).replaceAll(
View Full Code Here

Examples of org.apache.ivy.core.settings.IvySettings

    protected void setUp() throws Exception {
        super.setUp();

        Message.setDefaultLogger(new DefaultMessageLogger(Message.MSG_WARN));

        this.settings = new IvySettings();
        // prevent test from polluting local cache
        settings.setDefaultCache(new File("build/cache"));
    }
View Full Code Here

Examples of org.apache.ivy.core.settings.IvySettings

     */
    public void bind() {
        pushContext();
        try {
            if (settings == null) {
                settings = new IvySettings();
            }
            if (eventManager == null) {
                eventManager = new EventManager();
            }
            if (sortEngine == null) {
View Full Code Here

Examples of org.apache.ivy.core.settings.IvySettings

        boolean validate = line.hasOption("novalidate") ? false : true;

        Ivy ivy = Ivy.newInstance();
        initMessage(line, ivy);
        IvySettings settings = initSettings(line, ivy);
        ivy.pushContext();

        File cache = new File(settings.substitute(line.getOptionValue("cache", settings
                .getDefaultCache().getAbsolutePath())));

        if (line.hasOption("cache")) {
            // override default cache path with user supplied cache path
            settings.setDefaultCache(cache);
        }

        if (!cache.exists()) {
            cache.mkdirs();
        } else if (!cache.isDirectory()) {
            error(cache + " is not a directory");
        }

        String[] confs;
        if (line.hasOption("confs")) {
            confs = line.getOptionValues("confs");
        } else {
            confs = new String[] {"*"};
        }

        File ivyfile;
        if (line.hasOption("dependency")) {
            String[] dep = line.getOptionValues("dependency");
            ivyfile = File.createTempFile("ivy", ".xml");
            ivyfile.deleteOnExit();
            DefaultModuleDescriptor md = DefaultModuleDescriptor
                    .newDefaultInstance(ModuleRevisionId.newInstance(dep[0], dep[1] + "-caller",
                        "working"));
            DefaultDependencyDescriptor dd = new DefaultDependencyDescriptor(md,
                    ModuleRevisionId.newInstance(dep[0], dep[1], dep[2]), false, false, true);
            for (int i = 0; i < confs.length; i++) {
                dd.addDependencyConfiguration("default", confs[i]);
            }
            md.addDependency(dd);
            XmlModuleDescriptorWriter.write(md, ivyfile);
            confs = new String[] {"default"};
        } else {
            ivyfile = new File(settings.substitute(line.getOptionValue("ivy", "ivy.xml")));
            if (!ivyfile.exists()) {
                error("ivy file not found: " + ivyfile);
            } else if (ivyfile.isDirectory()) {
                error("ivy file is not a file: " + ivyfile);
            }
        }

        if (line.hasOption("useOrigin")) {
            ivy.getSettings().useDeprecatedUseOrigin();
        }
        ResolveOptions resolveOptions = new ResolveOptions()
                .setConfs(confs)
                .setValidate(validate)
                .setResolveMode(line.getOptionValue("mode"))
                .setArtifactFilter(
                    FilterHelper.getArtifactTypeFilter(line.getOptionValues("types")));
        if (line.hasOption("notransitive")) {
            resolveOptions.setTransitive(false);
        }
        if (line.hasOption("refresh")) {
            resolveOptions.setRefresh(true);
        }
        ResolveReport report = ivy.resolve(ivyfile.toURI().toURL(), resolveOptions);
        if (report.hasError()) {
            System.exit(1);
        }
        ModuleDescriptor md = report.getModuleDescriptor();

        if (confs.length == 1 && "*".equals(confs[0])) {
            confs = md.getConfigurationsNames();
        }
        if (line.hasOption("retrieve")) {
            String retrievePattern = settings.substitute(line.getOptionValue("retrieve"));
            if (retrievePattern.indexOf("[") == -1) {
                retrievePattern = retrievePattern + "/lib/[conf]/[artifact].[ext]";
            }
            String ivyPattern = settings.substitute(line.getOptionValue("ivypattern"));
            ivy.retrieve(
                md.getModuleRevisionId(),
                retrievePattern,
                new RetrieveOptions()
                        .setConfs(confs)
                        .setSync(line.hasOption("sync"))
                        .setUseOrigin(line.hasOption("useOrigin"))
                        .setDestIvyPattern(ivyPattern)
                        .setArtifactFilter(
                            FilterHelper.getArtifactTypeFilter(line.getOptionValues("types")))
                        .setMakeSymlinks(line.hasOption("symlink"))
                        .setMakeSymlinksInMass(line.hasOption("symlinkmass")));
        }
        if (line.hasOption("cachepath")) {
            outputCachePath(ivy, cache, md, confs,
                line.getOptionValue("cachepath", "ivycachepath.txt"));
        }

        if (line.hasOption("revision")) {
            ivy.deliver(
                md.getResolvedModuleRevisionId(),
                settings.substitute(line.getOptionValue("revision")),
                settings.substitute(line.getOptionValue("deliverto", "ivy-[revision].xml")),
                DeliverOptions.newInstance(settings)
                        .setStatus(settings.substitute(line.getOptionValue("status", "release")))
                        .setValidate(validate));
            if (line.hasOption("publish")) {
                ivy.publish(
                    md.getResolvedModuleRevisionId(),
                    Collections.singleton(settings.substitute(line.getOptionValue("publishpattern",
                        "distrib/[type]s/[artifact]-[revision].[ext]"))),
                    line.getOptionValue("publish"),
                    new PublishOptions()
                            .setPubrevision(settings.substitute(line.getOptionValue("revision")))
                            .setValidate(validate)
                            .setSrcIvyPattern(
                                settings.substitute(line.getOptionValue("deliverto",
                                    "ivy-[revision].xml")))
                            .setOverwrite(line.hasOption("overwrite")));
            }
        }
        if (line.hasOption("main")) {
View Full Code Here

Examples of org.apache.ivy.core.settings.IvySettings

        return fileList;
    }

    private static IvySettings initSettings(CommandLine line, Ivy ivy)
            throws java.text.ParseException, IOException, ParseException {
        IvySettings settings = ivy.getSettings();
        settings.addAllVariables(System.getProperties());
        if (line.hasOption("m2compatible")) {
            settings.setVariable("ivy.default.configuration.m2compatible", "true");
        }

        configureURLHandler(line.getOptionValue("realm", null), line.getOptionValue("host", null),
            line.getOptionValue("username", null), line.getOptionValue("passwd", null));
View Full Code Here

Examples of org.apache.ivy.core.settings.IvySettings

    private boolean installOriginalMetadata = false;

    public void doExecute() throws BuildException {
        Ivy ivy = getIvyInstance();
        IvySettings settings = ivy.getSettings();
        if (organisation == null) {
            throw new BuildException("no organisation provided for ivy publish task: "
                    + "It can either be set explicitely via the attribute 'organisation' "
                    + "or via 'ivy.organisation' property or a prior call to <resolve/>");
        }
        if (module == null && PatternMatcher.EXACT.equals(matcher)) {
            throw new BuildException("no module name provided for ivy publish task: "
                    + "It can either be set explicitely via the attribute 'module' "
                    + "or via 'ivy.module' property or a prior call to <resolve/>");
        } else if (module == null && !PatternMatcher.EXACT.equals(matcher)) {
            module = PatternMatcher.ANY_EXPRESSION;
        }
        if (revision == null && PatternMatcher.EXACT.equals(matcher)) {
            throw new BuildException("no module revision provided for ivy publish task: "
                    + "It can either be set explicitely via the attribute 'revision' "
                    + "or via 'ivy.revision' property or a prior call to <resolve/>");
        } else if (revision == null && !PatternMatcher.EXACT.equals(matcher)) {
            revision = PatternMatcher.ANY_EXPRESSION;
        }
        if (branch == null && PatternMatcher.EXACT.equals(matcher)) {
            branch = settings.getDefaultBranch(ModuleId.newInstance(organisation, module));
        } else if (branch == null && !PatternMatcher.EXACT.equals(matcher)) {
            branch = PatternMatcher.ANY_EXPRESSION;
        }
        if (from == null) {
            throw new BuildException(
View Full Code Here

Examples of org.apache.ivy.core.settings.IvySettings

            output.getParentFile().mkdirs();
        }
        PrintWriter out = new PrintWriter(new OutputStreamWriter(new FileOutputStream(output),
                "UTF-8"));
        try {
            IvySettings settings = IvyContext.getContext().getSettings();
            IvyVariableContainer variables = new IvyVariableContainerWrapper(
                    settings.getVariableContainer());

            variables.setVariable("ivy.pom.license", SKIP_LINE, true);
            variables.setVariable("ivy.pom.header", SKIP_LINE, true);
            variables.setVariable("ivy.pom.groupId", SKIP_LINE, true);
            variables.setVariable("ivy.pom.artifactId", SKIP_LINE, true);
View Full Code Here

Examples of org.apache.ivy.core.settings.IvySettings

            throw new BuildException(
                    "at least one nested fileset should be provided in ivy build list");
        }

        Ivy ivy = getIvyInstance();
        IvySettings settings = ivy.getSettings();

        ivyFilePath = getProperty(ivyFilePath, settings, "ivy.buildlist.ivyfilepath");

        Path path = new Path(getProject());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.