Android Open Source - m2e-android Android Maven Project Configurator






From Project

Back to project page m2e-android.

License

The source code is released under:

Eclipse Public License - v 1.0 THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECI...

If you think the Android project m2e-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*******************************************************************************
 * Copyright (c) 2009 - 2014 Ricardo Gladwell and Hugo Josefson
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *******************************************************************************/
/*from  ww w  . j av a 2s. c o  m*/
package me.gladwell.eclipse.m2e.android;

import java.util.List;

import me.gladwell.eclipse.m2e.android.configuration.DependencyNotFoundInWorkspace;
import me.gladwell.eclipse.m2e.android.configuration.classpath.ClasspathConfigurer;
import me.gladwell.eclipse.m2e.android.configuration.classpath.RawClasspathConfigurer;
import me.gladwell.eclipse.m2e.android.configuration.workspace.WorkspaceConfigurer;
import me.gladwell.eclipse.m2e.android.project.AdtEclipseAndroidProject;
import me.gladwell.eclipse.m2e.android.project.AndroidProjectFactory;
import me.gladwell.eclipse.m2e.android.project.EclipseAndroidProject;
import me.gladwell.eclipse.m2e.android.project.MavenAndroidProject;

import org.apache.maven.plugin.MojoExecution;
import org.apache.maven.project.MavenProject;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.m2e.core.lifecyclemapping.model.IPluginExecutionMetadata;
import org.eclipse.m2e.core.project.IMavenProjectFacade;
import org.eclipse.m2e.core.project.IMavenProjectRegistry;
import org.eclipse.m2e.core.project.configurator.AbstractBuildParticipant;
import org.eclipse.m2e.core.project.configurator.AbstractProjectConfigurator;
import org.eclipse.m2e.core.project.configurator.ProjectConfigurationRequest;
import org.eclipse.m2e.jdt.IClasspathDescriptor;
import org.eclipse.m2e.jdt.IJavaProjectConfigurator;

import com.google.inject.Inject;
import com.google.inject.Singleton;

@Singleton
public class AndroidMavenProjectConfigurator extends AbstractProjectConfigurator implements IJavaProjectConfigurator {

    @Inject private AbstractProjectConfigurator javaProjectConfigurator;

    @Inject private List<WorkspaceConfigurer> workspaceConfigurers;

    @Inject private List<RawClasspathConfigurer> rawClasspathConfigurers;

    @Inject private List<ClasspathConfigurer> classpathConfigurers;

    @Inject private AndroidProjectFactory<MavenAndroidProject, MavenProject> mavenProjectFactory;

    @Inject private AndroidProjectFactory<EclipseAndroidProject, IProject> eclipseProjectFactory;
    
    @Inject private IMavenProjectRegistry registry;

    public void configure(ProjectConfigurationRequest request, IProgressMonitor monitor) throws CoreException {
        markerManager.deleteMarkers(request.getPom(), AndroidMavenPlugin.APKLIB_ERROR_TYPE);

        try {
            final MavenAndroidProject mavenProject = mavenProjectFactory
                    .createAndroidProject(request.getMavenProject());
            final EclipseAndroidProject eclipseProject = eclipseProjectFactory.createAndroidProject(request
                    .getProject());

            if (mavenProject.isAndroidProject()) {
                javaProjectConfigurator.configure(request, monitor);

                for (WorkspaceConfigurer configurer : workspaceConfigurers) {
                    try {
                        if (configurer.isValid(mavenProject) && !configurer.isConfigured(eclipseProject)) {
                            configurer.configure(eclipseProject, mavenProject);
                        }
                    } catch (DependencyNotFoundInWorkspace e) {
                        markerManager.addErrorMarkers(request.getPom(), e.getType(), e);
                    }
                }
            }
        } catch (AndroidMavenException e) {
            throw new CoreException(new Status(IStatus.ERROR, AndroidMavenPlugin.PLUGIN_ID,
                    "error configuring project", e));
        }
    }

    public AbstractBuildParticipant getBuildParticipant(IMavenProjectFacade f, MojoExecution e,
            IPluginExecutionMetadata m) {
        return null;
    }

    public void configureClasspath(IMavenProjectFacade facade, IClasspathDescriptor classpath, IProgressMonitor monitor)
            throws CoreException {
        final MavenAndroidProject mavenProject = mavenProjectFactory.createAndroidProject(facade.getMavenProject());
        final EclipseAndroidProject eclipseProject = new AdtEclipseAndroidProject(registry, facade.getProject(), classpath);
        try {
            for (RawClasspathConfigurer configurer : rawClasspathConfigurers) {
                configurer.configure(mavenProject, eclipseProject, classpath);
            }
        } catch (Exception e) {
            throw new CoreException(new Status(IStatus.ERROR, AndroidMavenPlugin.PLUGIN_ID,
                    "error configuring project classpath", e));
        }
    }

    public void configureRawClasspath(ProjectConfigurationRequest request, IClasspathDescriptor classpath,
            IProgressMonitor monitor) throws CoreException {
        final MavenAndroidProject mavenProject = mavenProjectFactory.createAndroidProject(request.getMavenProject());
        final EclipseAndroidProject eclipseProject = new AdtEclipseAndroidProject(registry, request.getProject(), classpath);
        try {
            for (ClasspathConfigurer classpathConfigurer : classpathConfigurers) {
                if (classpathConfigurer.shouldApplyTo(mavenProject)) {
                    classpathConfigurer.configure(mavenProject, eclipseProject);
                }
            }
        } catch (Exception e) {
            throw new CoreException(new Status(IStatus.ERROR, AndroidMavenPlugin.PLUGIN_ID,
                    "error configuring project classpath", e));
        }
    }

}




Java Source Code List

.App1.java
.App2.java
com.example.android.HelloAndroidActivity.java
de.akquinet.android.archetypes.HelloAndroidActivity.java
de.akquinet.android.archetypes.HelloAndroidActivity.java
de.akquinet.android.archetypes.HelloAndroidActivity.java
me.gladwell.eclipse.m2e.android.AndroidMavenException.java
me.gladwell.eclipse.m2e.android.AndroidMavenLaunchConfigurationListener.java
me.gladwell.eclipse.m2e.android.AndroidMavenPlugin.java
me.gladwell.eclipse.m2e.android.AndroidMavenProjectConfigurator.java
me.gladwell.eclipse.m2e.android.JUnitClasspathProvider.java
me.gladwell.eclipse.m2e.android.Log.java
me.gladwell.eclipse.m2e.android.Maven.java
me.gladwell.eclipse.m2e.android.NonRuntimeDependenciesContainerInitializer.java
me.gladwell.eclipse.m2e.android.PluginModule.java
me.gladwell.eclipse.m2e.android.configuration.ClasspathLoaderDecorator.java
me.gladwell.eclipse.m2e.android.configuration.ClasspathLoader.java
me.gladwell.eclipse.m2e.android.configuration.ClasspathPersister.java
me.gladwell.eclipse.m2e.android.configuration.Classpaths.java
me.gladwell.eclipse.m2e.android.configuration.ConfigurationModule.java
me.gladwell.eclipse.m2e.android.configuration.DependencyNotFoundInWorkspace.java
me.gladwell.eclipse.m2e.android.configuration.NonRuntimeDependenciesClasspathContainer.java
me.gladwell.eclipse.m2e.android.configuration.ObjectSerializationClasspathPersister.java
me.gladwell.eclipse.m2e.android.configuration.ProjectConfigurationError.java
me.gladwell.eclipse.m2e.android.configuration.ProjectConfigurationException.java
me.gladwell.eclipse.m2e.android.configuration.PrunePlatformProvidedDependenciesClasspathLoader.java
me.gladwell.eclipse.m2e.android.configuration.PrunePlatformProvidedDependencies.java
me.gladwell.eclipse.m2e.android.configuration.classpath.AddGenFolderClasspathConfigurer.java
me.gladwell.eclipse.m2e.android.configuration.classpath.AddNonRuntimeClasspathContainerConfigurer.java
me.gladwell.eclipse.m2e.android.configuration.classpath.ClasspathConfigurer.java
me.gladwell.eclipse.m2e.android.configuration.classpath.ClasspathModule.java
me.gladwell.eclipse.m2e.android.configuration.classpath.IgnoreOptionalWarningsConfigurer.java
me.gladwell.eclipse.m2e.android.configuration.classpath.MarkAndroidClasspathContainerNotExportedConfigurer.java
me.gladwell.eclipse.m2e.android.configuration.classpath.MarkMavenClasspathContianerExportedConfigurer.java
me.gladwell.eclipse.m2e.android.configuration.classpath.ModifySourceFolderOutputClasspathConfigurer.java
me.gladwell.eclipse.m2e.android.configuration.classpath.Paths.java
me.gladwell.eclipse.m2e.android.configuration.classpath.PersistNonRuntimeClasspathConfigurer.java
me.gladwell.eclipse.m2e.android.configuration.classpath.RawClasspathConfigurer.java
me.gladwell.eclipse.m2e.android.configuration.classpath.RemoveJREClasspathContainerConfigurer.java
me.gladwell.eclipse.m2e.android.configuration.classpath.RemoveNonRuntimeDependenciesConfigurer.java
me.gladwell.eclipse.m2e.android.configuration.classpath.RemoveNonRuntimeProjectsConfigurer.java
me.gladwell.eclipse.m2e.android.configuration.workspace.AddAndroidNatureWorkspaceConfigurer.java
me.gladwell.eclipse.m2e.android.configuration.workspace.ConvertLibraryWorkspaceConfigurer.java
me.gladwell.eclipse.m2e.android.configuration.workspace.FixerWorkspaceConfigurer.java
me.gladwell.eclipse.m2e.android.configuration.workspace.LibraryDependenciesWorkspaceConfigurer.java
me.gladwell.eclipse.m2e.android.configuration.workspace.LinkAndroidManifestConfigurer.java
me.gladwell.eclipse.m2e.android.configuration.workspace.LinkAssetsFolderConfigurer.java
me.gladwell.eclipse.m2e.android.configuration.workspace.LinkResourceDirectoryConfigurer.java
me.gladwell.eclipse.m2e.android.configuration.workspace.OrderBuildersWorkspaceConfigurer.java
me.gladwell.eclipse.m2e.android.configuration.workspace.WorkspaceConfigurer.java
me.gladwell.eclipse.m2e.android.configuration.workspace.WorkspaceModule.java
me.gladwell.eclipse.m2e.android.project.AdtEclipseAndroidProject.java
me.gladwell.eclipse.m2e.android.project.AdtEclipseAndroidWorkspace.java
me.gladwell.eclipse.m2e.android.project.AndroidProjectFactory.java
me.gladwell.eclipse.m2e.android.project.AndroidWorkspace.java
me.gladwell.eclipse.m2e.android.project.Classpath.java
me.gladwell.eclipse.m2e.android.project.Dependency.java
me.gladwell.eclipse.m2e.android.project.EclipseAndroidProjectFactory.java
me.gladwell.eclipse.m2e.android.project.EclipseAndroidProject.java
me.gladwell.eclipse.m2e.android.project.EclipseSourceEntry.java
me.gladwell.eclipse.m2e.android.project.JaywayMavenAndroidProject.java
me.gladwell.eclipse.m2e.android.project.MavenAndroidProjectFactory.java
me.gladwell.eclipse.m2e.android.project.MavenAndroidProject.java
me.gladwell.eclipse.m2e.android.project.MavenDependency.java
me.gladwell.eclipse.m2e.android.project.MavenEclipseClasspath.java
me.gladwell.eclipse.m2e.android.project.MavenToEclipseAndroidProjectConverter.java
me.gladwell.eclipse.m2e.android.project.ProjectModule.java
me.gladwell.eclipse.m2e.android.project.SourceEntry.java
me.gladwell.eclipse.m2e.android.resolve.HardCodedDependency.java
me.gladwell.eclipse.m2e.android.resolve.HardCodedLibraryResolver.java
me.gladwell.eclipse.m2e.android.resolve.LibraryResolver.java
me.gladwell.eclipse.m2e.android.resolve.ResolutionModule.java
me.gladwell.eclipse.m2e.inject.GuiceExtensionFactory.java
your.company.HelloAndroidActivity.java
your.company.HelloAndroidActivity.java
your.company.HelloAndroidActivity.java
your.company.HelloAndroidActivity.java
your.company.HelloAndroidActivity.java
your.company.HelloAndroidActivity.java
your.company.HelloAndroidActivity.java
your.company.HelloAndroidActivity.java
your.company.Library.java
your.company.Library.java