Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Created multiple maven plugins #40

Merged
merged 4 commits into from
Oct 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pull_request_push_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ jobs:
distribution: ${{ matrix.jdk-distribution }}
cache: 'maven'
- name: Maven build
run: mvn clean install -B -s build/settings.xml
run: mvn clean install -B -s build/settings.xml -Dorg.apache.maven.user-settings=build/settings.xml
53 changes: 53 additions & 0 deletions mta-plugin/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.jboss.windup.plugin</groupId>
<artifactId>windup-maven-plugin-parent</artifactId>
<version>6.0.1-SNAPSHOT</version>
</parent>

<artifactId>mta-maven-plugin</artifactId>
<packaging>maven-plugin</packaging>

<name>MTA Maven Plugin</name>

<dependencies>
<dependency>
<groupId>org.jboss.windup</groupId>
<artifactId>windup-bootstrap-mta</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.windup.rules</groupId>
<artifactId>windup-rulesets-mta</artifactId>
<version>${version.windup-rulesets}</version>
</dependency>
</dependencies>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-plugin-plugin</artifactId>
<configuration>
<goalPrefix>mta</goalPrefix>
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
</configuration>
<executions>
<execution>
<id>mojo-descriptor</id>
<goals>
<goal>descriptor</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public class WindupMojo extends AbstractMojo


private static final String WINDUP_RULES_GROUP_ID = "org.jboss.windup.rules";
private static final String WINDUP_RULES_ARTIFACT_ID = "windup-rulesets";
private static final String WINDUP_RULES_ARTIFACT_ID = "windup-rulesets-mta";


public void execute() throws MojoExecutionException
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package org.jboss.windup.plugin;


import org.apache.maven.execution.DefaultMavenExecutionRequest;
import org.apache.maven.execution.MavenExecutionRequest;
import org.apache.maven.execution.MavenExecutionRequestPopulator;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.testing.AbstractMojoTestCase;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.ProjectBuilder;
import org.apache.maven.project.ProjectBuildingRequest;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class WindupMojoTest extends AbstractMojoTestCase
{
Properties versions = new Properties();

/**
* @see junit.framework.TestCase#setUp()
*/
protected void setUp() throws Exception
{
// required for mojo lookups to work
super.setUp();


try
{
final InputStream propsFile = WindupMojo.class.getClassLoader().getResourceAsStream("META-INF/versions.properties");
versions.load(propsFile);
}
catch (IOException ex)
{
final String msg = "Can't load the version definitions from classpath: META-INF/versions.properties";
throw new MojoExecutionException(msg, ex);
}
}

public void testNoWindupVersionParameter() throws Exception
{
File testPom = new File( getBasedir(),
"src/test/resources/mojoTestConfig.xml" );
assertNotNull(testPom);

WindupMojo mojo = (WindupMojo)lookupMojo("windup", testPom);
assertNotNull( mojo );
assertNull(mojo.getWindupVersion());
mojo.execute();


assertEquals(mojo.getWindupVersion(), versions.getProperty("version.windup"));
}

}
32 changes: 32 additions & 0 deletions mta-plugin/src/test/resources/mojoTestConfig.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<project>
<build>
<plugins>
<plugin>
<groupId>org.jboss.windup.plugin</groupId>
<artifactId>mta-maven-plugin</artifactId>
<version>6.0.1-SNAPSHOT</version>
<executions>
<execution>
<id>run-windup</id>
<phase>package</phase>
<goals>
<goal>windup</goal>
</goals>
</execution>
</executions>
<configuration>
<packages>
<package>org.apache</package>
</packages>
<targetTechnologies>
<target>eap:7</target>
</targetTechnologies>
<inputDirectory>src/main/java</inputDirectory>
<outputDirectory>target</outputDirectory>
<offlineMode>true</offlineMode>
<overwrite>false</overwrite>
</configuration>
</plugin>
</plugins>
</build>
</project>
53 changes: 53 additions & 0 deletions mtr-plugin/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.jboss.windup.plugin</groupId>
<artifactId>windup-maven-plugin-parent</artifactId>
<version>6.0.1-SNAPSHOT</version>
</parent>

<artifactId>mtr-maven-plugin</artifactId>
<packaging>maven-plugin</packaging>

<name>MTR Maven Plugin</name>

<dependencies>
<dependency>
<groupId>org.jboss.windup</groupId>
<artifactId>windup-bootstrap-mtr</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.windup.rules</groupId>
<artifactId>windup-rulesets-mtr</artifactId>
<version>${version.windup-rulesets}</version>
</dependency>
</dependencies>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-plugin-plugin</artifactId>
<configuration>
<goalPrefix>mtr</goalPrefix>
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
</configuration>
<executions>
<execution>
<id>mojo-descriptor</id>
<goals>
<goal>descriptor</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
55 changes: 55 additions & 0 deletions mtr-plugin/src/it/settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
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.
-->

<settings>
<profiles>
<profile>
<id>it-repo</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>local.central</id>
<url>@localRepositoryUrl@</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>local.central</id>
<url>@localRepositoryUrl@</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
</settings>
54 changes: 54 additions & 0 deletions mtr-plugin/src/it/simple-it/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.jboss.windup.plugin.it</groupId>
<artifactId>simple-it</artifactId>
<version>6.0.1-SNAPSHOT</version>

<description>A simple IT verifying the basic use case.</description>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<version.windupcore>6.0.1-SNAPSHOT</version.windupcore>
<version.forge>3.7.2.Final</version.forge>
<inputDirectory>${project.basedir}/../../../</inputDirectory>
<outputDirectory>${project.build.directory}/windup-report</outputDirectory>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.jboss.windup.plugin</groupId>
<artifactId>windup-maven-plugin</artifactId>
<version>6.0.1-SNAPSHOT</version>
<executions>
<execution>
<id>run-windup</id>
<phase>package</phase>
<goals>
<goal>windup</goal>
</goals>
</execution>
</executions>
<configuration>
<packages>
<package>org.apache</package>
<package>com.acme</package>
</packages>
<targetTechnologies>
<target>eap:7</target>
</targetTechnologies>
<inputDirectory>${inputDirectory}</inputDirectory>
<outputDirectory>${outputDirectory}</outputDirectory>
<offlineMode>true</offlineMode>
<overwrite>false</overwrite>
<windupVersion>${version.windupcore}</windupVersion>
<analyzeKnownLibraries>false</analyzeKnownLibraries>
</configuration>
</plugin>

</plugins>
</build>
</project>
3 changes: 3 additions & 0 deletions mtr-plugin/src/it/simple-it/verify.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
File touchFile = new File( basedir, "target/touch.txt" );

assert touchFile.isFile()
Loading