Example usage for org.apache.maven.artifact ArtifactScopeEnum DEFAULT_SCOPE

List of usage examples for org.apache.maven.artifact ArtifactScopeEnum DEFAULT_SCOPE

Introduction

In this page you can find the example usage for org.apache.maven.artifact ArtifactScopeEnum DEFAULT_SCOPE.

Prototype

ArtifactScopeEnum DEFAULT_SCOPE

To view the source code for org.apache.maven.artifact ArtifactScopeEnum DEFAULT_SCOPE.

Click Source Link

Usage

From source file:org.ebayopensource.turmeric.eclipse.mavenapi.impl.MavenEclipseUtil.java

License:Open Source License

/**
 * Convert to artifact metadata./*from   w  ww . j  av a 2  s.  co  m*/
 *
 * @param pom the pom
 * @return the artifact metadata
 */
public static ArtifactMetadata convertToArtifactMetadata(final Model pom) {
    return new EclipseArtifactMetadata(pom.getGroupId(), pom.getArtifactId(), pom.getVersion(),
            pom.getPackaging(), ArtifactScopeEnum.DEFAULT_SCOPE);
}

From source file:org.ebayopensource.turmeric.eclipse.mavenapi.impl.MavenEclipseUtil.java

License:Open Source License

/**
 * Artifact metadata./*from  w  w  w . ja  va  2s  .  c  o m*/
 *
 * @param library the library
 * @return the artifact metadata
 */
public static ArtifactMetadata artifactMetadata(final String library) {
    final String[] coordinates = StringUtils.split(library, ARTIFACT_METADATA_SEPARATOR);
    final ArtifactMetadata metadata;
    if (coordinates.length == 1 || coordinates.length == 0)
        metadata = new ArtifactMetadata(library);
    else if (coordinates.length == 2)
        metadata = new EclipseArtifactMetadata(coordinates[0], coordinates[1], null, null,
                ArtifactScopeEnum.DEFAULT_SCOPE);
    else if (coordinates.length == 3)
        metadata = new EclipseArtifactMetadata(coordinates[0], coordinates[1], null, coordinates[2],
                ArtifactScopeEnum.DEFAULT_SCOPE);
    else if (coordinates.length == 4)
        metadata = new EclipseArtifactMetadata(coordinates[0], coordinates[1], coordinates[3], coordinates[2],
                ArtifactScopeEnum.DEFAULT_SCOPE);
    else
        metadata = new EclipseArtifactMetadata(coordinates[0], coordinates[1], coordinates[3], coordinates[2],
                ArtifactScopeEnum.valueOf(coordinates[4]));
    return metadata;
}

From source file:org.ebayopensource.turmeric.eclipse.mavenapi.impl.MavenEclipseUtil.java

License:Open Source License

/**
 * Artifact metadata./*from w w  w . ja va2s.  c o m*/
 *
 * @param file the file
 * @param packaging the packaging
 * @return the artifact metadata
 */
public static ArtifactMetadata artifactMetadata(final IndexedArtifactFile file, final String packaging) {
    return new EclipseArtifactMetadata(file.group, file.artifact, file.version, packaging,
            ArtifactScopeEnum.DEFAULT_SCOPE);
}

From source file:org.ebayopensource.turmeric.eclipse.mavenapi.impl.MavenEclipseUtil.java

License:Open Source License

/**
 * Dependency.//from   w  w  w  .  j a v a  2 s  .c o m
 *
 * @param metadata the metadata
 * @return the dependency
 */
public static Dependency dependency(final ArtifactMetadata metadata) {
    final Dependency dependency = new Dependency();
    dependency.setGroupId(metadata.getGroupId());
    dependency.setArtifactId(metadata.getArtifactId());
    dependency.setVersion(metadata.getVersion());
    dependency.setClassifier(metadata.getClassifier());
    dependency.setType(metadata.getType());
    if (metadata.getScope() != null
            && ArtifactScopeEnum.DEFAULT_SCOPE.getScope().equals(metadata.getScope()) == false)
        dependency.setScope(metadata.getScope());
    return dependency;
}

From source file:org.ebayopensource.turmeric.frameworkjars.ui.CopyLibraryDialog.java

License:Open Source License

/**
 * Adds the library chooser./*  ww w  .j a va  2 s.c om*/
 *
 * @param parentComposite the parent composite
 * @return the composite
 */
protected Composite addLibraryChooser(Composite parentComposite) {
    parentComposite = new Composite(parentComposite, SWT.NONE);
    GridLayout layout = new GridLayout(4, false);
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    parentComposite.setLayout(layout);
    parentComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    parentComposite.setFont(parentComposite.getFont());

    new Label(parentComposite, SWT.LEFT).setText("&Maven Library:");
    libraryText = new Text(parentComposite, SWT.BORDER);
    libraryText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    libraryText.setEditable(false);

    Button browseBtn = new Button(parentComposite, SWT.PUSH);
    browseBtn.setAlignment(SWT.RIGHT);
    browseBtn.setText("&Search...");

    final SelectionListener workspaceBrowseListener = new SelectionListener() {
        @Override
        public void widgetDefaultSelected(final SelectionEvent e) {
            widgetSelected(e);
        }

        @Override
        public void widgetSelected(final SelectionEvent e) {
            final MavenRepositorySearchDialog dialog = new MavenRepositorySearchDialog(getShell(),
                    "Select Library to copy:", IIndex.SEARCH_ARTIFACT, null);
            if (dialog.open() == Window.OK) {
                final Object obj = dialog.getFirstResult();
                if (obj instanceof IndexedArtifactFile) {
                    final IndexedArtifactFile artifactFile = (IndexedArtifactFile) obj;
                    final ArtifactKey artifactKey = artifactFile.getArtifactKey();

                    metadata = new EclipseArtifactMetadata(artifactKey.getGroupId(),
                            artifactKey.getArtifactId(), artifactKey.getVersion(), "jar",
                            ArtifactScopeEnum.DEFAULT_SCOPE);
                    libraryText.setText(metadata.toString());
                }
            }
            dialogChanged();
        }
    };
    browseBtn.addSelectionListener(workspaceBrowseListener);

    return parentComposite;
}