Skip to content

Commit

Permalink
Remove remaining legacy plexus components
Browse files Browse the repository at this point in the history
This relates to adobe#206
  • Loading branch information
kwin committed Jul 26, 2024
1 parent d2df2a9 commit 97f94ce
Show file tree
Hide file tree
Showing 7 changed files with 205 additions and 74 deletions.
13 changes: 0 additions & 13 deletions aemanalyser-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,6 @@ governing permissions and limitations under the License.

<build>
<plugins>
<plugin>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-metadata</artifactId>
<version>2.2.0</version>
<executions>
<execution>
<id>generate-metadata</id>
<goals>
<goal>generate-metadata</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.eclipse.aether.resolution.ArtifactResolutionException;
import org.eclipse.aether.resolution.ArtifactResult;

import com.adobe.aem.analyser.mojos.extensions.DependencyLifecycleParticipant;
import com.adobe.aem.analyser.result.AemAnalyserAnnotation;
import com.adobe.aem.analyser.result.AemAnalyserResult;
import com.adobe.aem.project.model.Application;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.adobe.aem.analyser.mojos.extensions;

import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.inject.Named;
import javax.inject.Provider;
import javax.inject.Singleton;

import org.apache.maven.lifecycle.mapping.Lifecycle;
import org.apache.maven.lifecycle.mapping.LifecycleMapping;
import org.apache.maven.lifecycle.mapping.LifecyclePhase;

import com.adobe.aem.analyser.mojos.Constants;

@Singleton
@Named(Constants.PACKAGING_AEM_ANALYSE)
public class AemAnalyseLifecycleMappingProvider implements Provider<LifecycleMapping> {

private static final String DEFAULT_LIFECYCLE_KEY = "default";
private static final Map<String, LifecyclePhase> BINDINGS;
static {
BINDINGS = new HashMap<>();
BINDINGS.put("test", new LifecyclePhase("com.adobe.aem:aemanalyser-maven-plugin:analyse"));
}

private final Lifecycle defaultLifecycle;

private final LifecycleMapping lifecycleMapping;

public AemAnalyseLifecycleMappingProvider() {
this.defaultLifecycle = new Lifecycle();
this.defaultLifecycle.setId(DEFAULT_LIFECYCLE_KEY);
this.defaultLifecycle.setLifecyclePhases(BINDINGS);

this.lifecycleMapping = new LifecycleMapping() {
@Override
public Map<String, Lifecycle> getLifecycles() {
return Collections.singletonMap(DEFAULT_LIFECYCLE_KEY, defaultLifecycle);
}

@Override
public List<String> getOptionalMojos(String lifecycle) {
return null;
}

@Override
public Map<String, String> getPhases(String lifecycle) {
if (DEFAULT_LIFECYCLE_KEY.equals(lifecycle)) {
return defaultLifecycle.getPhases();
} else {
return null;
}
}
};
}

@Override
public LifecycleMapping get() {
return lifecycleMapping;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.adobe.aem.analyser.mojos.extensions;

import javax.inject.Named;
import javax.inject.Singleton;

import org.apache.maven.artifact.handler.DefaultArtifactHandler;

import com.adobe.aem.analyser.mojos.Constants;

@Singleton
@Named(Constants.PACKAGING_AEMAPP)
public class AemAppArtifactHandler extends DefaultArtifactHandler {

public AemAppArtifactHandler() {
super(Constants.PACKAGING_AEMAPP);
setIncludesDependencies(false);
setExtension("zip");
setLanguage("java");
setAddedToClasspath(false);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.adobe.aem.analyser.mojos.extensions;

import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.inject.Named;
import javax.inject.Provider;
import javax.inject.Singleton;

import org.apache.maven.lifecycle.mapping.Lifecycle;
import org.apache.maven.lifecycle.mapping.LifecycleMapping;
import org.apache.maven.lifecycle.mapping.LifecyclePhase;

import com.adobe.aem.analyser.mojos.Constants;

@Singleton
@Named(Constants.PACKAGING_AEMAPP)
public class AemAppLifecycleMappingProvider implements Provider<LifecycleMapping> {

private static final String DEFAULT_LIFECYCLE_KEY = "default";
private static final Map<String, LifecyclePhase> BINDINGS;
static {
BINDINGS = new HashMap<>();
BINDINGS.put("package", new LifecyclePhase("com.adobe.aem:aemanalyser-maven-plugin:package-app"));
BINDINGS.put("verify", new LifecyclePhase("com.adobe.aem:aemanalyser-maven-plugin:project-analyse"));
BINDINGS.put("install", new LifecyclePhase("org.apache.maven.plugins:maven-install-plugin:install"));
BINDINGS.put("deploy", new LifecyclePhase("org.apache.maven.plugins:maven-deploy-plugin:deploy"));
}

private final Lifecycle defaultLifecycle;

private final LifecycleMapping lifecycleMapping;

public AemAppLifecycleMappingProvider() {
this.defaultLifecycle = new Lifecycle();
this.defaultLifecycle.setId(DEFAULT_LIFECYCLE_KEY);
this.defaultLifecycle.setLifecyclePhases(BINDINGS);

this.lifecycleMapping = new LifecycleMapping() {
@Override
public Map<String, Lifecycle> getLifecycles() {
return Collections.singletonMap(DEFAULT_LIFECYCLE_KEY, defaultLifecycle);
}

@Override
public List<String> getOptionalMojos(String lifecycle) {
return null;
}

@Override
public Map<String, String> getPhases(String lifecycle) {
if (DEFAULT_LIFECYCLE_KEY.equals(lifecycle)) {
return defaultLifecycle.getPhases();
} else {
return null;
}
}
};
}

@Override
public LifecycleMapping get() {
return lifecycleMapping;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
OF ANY KIND, either express or implied. See the License for the specific language
governing permissions and limitations under the License.
*/
package com.adobe.aem.analyser.mojos;
package com.adobe.aem.analyser.mojos.extensions;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
Expand Down Expand Up @@ -40,6 +40,7 @@
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;

import com.adobe.aem.analyser.mojos.Constants;
import com.adobe.aem.project.model.Application;
import com.adobe.aem.project.model.ArtifactsFile;
import com.adobe.aem.project.model.Module;
Expand Down

This file was deleted.

0 comments on commit 97f94ce

Please sign in to comment.