Search in sources :

Example 1 with MavenRemoteRepository

use of org.jboss.galleon.cli.config.mvn.MavenRemoteRepository in project galleon by wildfly.

the class MavenGetInfo method runCommand.

@Override
protected void runCommand(PmCommandInvocation session) throws CommandExecutionException {
    Table t = new Table(Headers.CONFIGURATION_ITEM, Headers.VALUE);
    MavenConfig config = session.getPmSession().getPmConfiguration().getMavenConfig();
    t.addLine("Maven xml settings", (config.getSettings() == null ? "No settings file set" : config.getSettings().normalize().toString()));
    t.addLine("Local repository", config.getLocalRepository().normalize().toString());
    t.addLine("Default release policy", config.getDefaultReleasePolicy());
    t.addLine("Default snapshot policy", config.getDefaultSnapshotPolicy());
    t.addLine("Enable release", "" + config.isReleaseEnabled());
    t.addLine("Enable snapshot", "" + config.isSnapshotEnabled());
    t.addLine("Offline", "" + config.isOffline());
    Cell repositories = new Cell();
    Cell title = new Cell("Remote repositories");
    if (config.getRemoteRepositories().isEmpty()) {
        repositories.addLine("None");
    } else {
        for (MavenRemoteRepository rep : session.getPmSession().getPmConfiguration().getMavenConfig().getRemoteRepositories()) {
            repositories.addLine(rep.getName());
            repositories.addLine(" url=" + rep.getUrl());
            repositories.addLine(" type=" + rep.getType());
            repositories.addLine(" release=" + (rep.getEnableRelease() == null ? config.isReleaseEnabled() : rep.getEnableRelease()));
            repositories.addLine(" releaseUpdatePolicy=" + (rep.getReleaseUpdatePolicy() == null ? config.getDefaultReleasePolicy() : rep.getReleaseUpdatePolicy()));
            repositories.addLine(" snapshot=" + (rep.getEnableSnapshot() == null ? config.isSnapshotEnabled() : rep.getEnableSnapshot()));
            repositories.addLine(" snapshotUpdatePolicy=" + (rep.getSnapshotUpdatePolicy() == null ? config.getDefaultSnapshotPolicy() : rep.getSnapshotUpdatePolicy()));
        }
    }
    t.addCellsLine(title, repositories);
    t.sort(Table.SortType.ASCENDANT);
    session.println(t.build());
}
Also used : Table(org.jboss.galleon.cli.cmd.Table) MavenRemoteRepository(org.jboss.galleon.cli.config.mvn.MavenRemoteRepository) MavenConfig(org.jboss.galleon.cli.config.mvn.MavenConfig) Cell(org.jboss.galleon.cli.cmd.Table.Cell)

Example 2 with MavenRemoteRepository

use of org.jboss.galleon.cli.config.mvn.MavenRemoteRepository in project galleon by wildfly.

the class MavenConfigTestCase method checkRepositories.

private static void checkRepositories(MavenConfig config, String url, String name, String name2) throws Exception {
    MavenRemoteRepository repo = getRepository(config, name);
    Assert.assertNotNull(repo);
    Assert.assertNull(repo.getReleaseUpdatePolicy());
    Assert.assertNull(repo.getSnapshotUpdatePolicy());
    Assert.assertNull(repo.getEnableRelease());
    Assert.assertNull(repo.getEnableSnapshot());
    Assert.assertEquals("default", repo.getType());
    Assert.assertEquals(url, repo.getUrl());
    repo = getRepository(config, name2);
    Assert.assertNotNull(repo);
    Assert.assertEquals("always", repo.getSnapshotUpdatePolicy());
    Assert.assertEquals("never", repo.getReleaseUpdatePolicy());
    Assert.assertTrue(repo.getEnableSnapshot());
    Assert.assertFalse(repo.getEnableRelease());
    Assert.assertEquals(url, repo.getUrl());
}
Also used : MavenRemoteRepository(org.jboss.galleon.cli.config.mvn.MavenRemoteRepository)

Aggregations

MavenRemoteRepository (org.jboss.galleon.cli.config.mvn.MavenRemoteRepository)2 Table (org.jboss.galleon.cli.cmd.Table)1 Cell (org.jboss.galleon.cli.cmd.Table.Cell)1 MavenConfig (org.jboss.galleon.cli.config.mvn.MavenConfig)1