Java Rules do not appear in my executed rules list
wstafford Aug 10, 2016 10:27 AMHello, I am new to Windup development and am trying to create java based rules with Windup. I have created a Maven project in eclipse and created two rules:
import org.jboss.windup.config.AbstractRuleProvider; |
import org.jboss.windup.config.metadata.MetadataBuilder; |
import org.jboss.windup.graph.GraphContext; |
import org.jboss.windup.reporting.config.Hint; |
import org.jboss.windup.reporting.config.Link; |
import org.jboss.windup.reporting.config.classification.Classification; |
import org.jboss.windup.rules.apps.xml.condition.XmlFile; |
import org.jboss.windup.rules.apps.xml.model.XmlFileModel; |
import org.jboss.windup.rules.files.FileMapping; |
import org.ocpsoft.rewrite.config.Configuration; |
import org.ocpsoft.rewrite.config.ConfigurationBuilder; |
public class RuleFlowRuleProvider extends AbstractRuleProvider{ |
|
|
public RuleFlowRuleProvider() { |
super(MetadataBuilder.forProvider(RuleFlowRuleProvider.class)); |
} |
|
@Override |
public Configuration getConfiguration(GraphContext context) |
{ |
return ConfigurationBuilder.begin() |
.addRule().when(FileMapping.from(".*\\.rfl$").to(XmlFileModel.class)).perform(FileMapping.from(".*\\.rfl$").to(XmlFileModel.class)).withId("FileMapping_.*\\.rfl$_1") |
.addRule().when(XmlFile.matchesXpath("//rfModel")).perform(Classification.as("Proprietary @ProprietaryServlet") |
.with(Link.to("Java EE 6 @WebServlet", "https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/index.html")) |
.withEffort(0) |
.and(Hint.withText("Migrate to Java EE 6 @WebServlet.").withEffort(8)) |
).withId("RuleFlowProvider_1"); |
} |
} |
My pom.xml looks like this:
<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.tools</groupId> |
<artifactId>parent</artifactId> |
<version>4.4.1.Alpha1-SNAPSHOT</version> |
</parent> |
|
|
<groupId>com.migrator.countbranch</groupId> |
<artifactId>count-branch-provider</artifactId> |
<version>0.0.1-SNAPSHOT</version> |
<name>CountBranch</name> |
<dependencies> |
<dependency> |
<groupId>org.jboss.windup.graph</groupId> |
<artifactId>windup-graph</artifactId> |
<classifier>forge-addon</classifier> |
<scope>provided</scope> |
</dependency> |
<dependency> |
<groupId>org.jboss.windup.config</groupId> |
<artifactId>windup-config</artifactId> |
<classifier>forge-addon</classifier> |
<scope>provided</scope> |
</dependency> |
<dependency> |
<groupId>org.jboss.windup.config</groupId> |
<artifactId>windup-config-xml</artifactId> |
<classifier>forge-addon</classifier> |
<scope>provided</scope> |
</dependency> |
<dependency> |
<groupId>org.jboss.windup.config</groupId> |
<artifactId>windup-config-groovy</artifactId> |
<classifier>forge-addon</classifier> |
<scope>provided</scope> |
</dependency> |
<dependency> |
<groupId>org.jboss.windup.utils</groupId> |
<artifactId>windup-utils</artifactId> |
<classifier>forge-addon</classifier> |
<scope>provided</scope> |
</dependency> |
<dependency> |
<groupId>org.jboss.windup.reporting</groupId> |
<artifactId>windup-reporting</artifactId> |
<classifier>forge-addon</classifier> |
<scope>provided</scope> |
</dependency> |
<!-- Dependencies on other rulesets --> |
<dependency> |
<groupId>org.jboss.windup.rules.apps</groupId> |
<artifactId>windup-rules-java</artifactId> |
<classifier>forge-addon</classifier> |
<scope>provided</scope> |
</dependency> |
<dependency> |
<groupId>org.jboss.windup.rules.apps</groupId> |
<artifactId>windup-rules-java-ee</artifactId> |
<classifier>forge-addon</classifier> |
<scope>provided</scope> |
</dependency> |
<dependency> |
<groupId>org.jboss.forge.furnace.container</groupId> |
<artifactId>cdi-api</artifactId> |
<scope>provided</scope> |
</dependency> |
<dependency> |
<groupId>org.jboss.forge.furnace.container</groupId> |
<artifactId>cdi</artifactId> |
<classifier>forge-addon</classifier> |
<scope>provided</scope> |
</dependency> |
<!-- Test dependencies --> |
<dependency> |
<groupId>org.jboss.forge.furnace.test</groupId> |
<artifactId>furnace-test-harness</artifactId> |
<scope>test</scope> |
</dependency> |
<dependency> |
<groupId>org.jboss.forge.furnace.test</groupId> |
<artifactId>arquillian-furnace-classpath</artifactId> |
<scope>test</scope> |
</dependency> |
<dependency> |
<groupId>junit</groupId> |
<artifactId>junit</artifactId> |
<version>4.11</version> |
<type>jar</type> |
</dependency> |
<dependency> |
<groupId>org.jboss.windup.exec</groupId> |
<artifactId>windup-exec</artifactId> |
<classifier>forge-addon</classifier> |
<scope>test</scope> |
</dependency> |
</dependencies> |
<dependencyManagement> |
<dependencies> |
<!-- BOM --> |
<dependency> |
<groupId>org.jboss.windup</groupId> |
<artifactId>windup-bom</artifactId> |
<version>${version.windup}</version> |
<type>pom</type> |
<scope>import</scope> |
</dependency> |
</dependencies> |
</dependencyManagement> |
<properties> |
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
<maven.compiler.source>1.7</maven.compiler.source> |
<maven.compiler.target>1.7</maven.compiler.target> |
<version.windup>2.6.0.Final</version.windup> |
</properties> |
<build> |
<directory>${project.basedir}/target</directory> |
<outputDirectory>${project.build.directory}/classes</outputDirectory> |
<finalName>${project.artifactId}-${project.version}</finalName> |
<testOutputDirectory>${project.build.directory}/test-classes</testOutputDirectory> |
<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory> |
<scriptSourceDirectory>src/main/scripts</scriptSourceDirectory> |
<testSourceDirectory>${project.basedir}/src/test/java</testSourceDirectory> |
<resources> |
<resource> |
<directory>${project.basedir}/src/main/resources</directory> |
</resource> |
</resources> |
<testResources> |
<testResource> |
<directory>${project.basedir}/src/test/resources</directory> |
</testResource> |
</testResources> |
<plugins> |
<!-- This plugin makes this artifact a Forge add-on. --> |
<plugin> |
<artifactId>maven-jar-plugin</artifactId> |
<executions> |
<execution> |
<id>create-forge-addon</id> |
<phase>package</phase> |
<goals> |
<goal>jar</goal> |
</goals> |
<configuration> |
<classifier>forge-addon</classifier> |
</configuration> |
</execution> |
</executions> |
</plugin> |
</plugins> |
</build> |
</project> |
|
When I run "mvn clean install" everything builds successfully. I go out to the windup folder and install the plugin "bin\windup.bat --install com.migrator.countbranch:count-branch-provider,0.0.1-SNAPSHOT". This too installs successfully. Finally I run "bin\windup.bat --sourceMode --input migration-rules\data --output migration-rules\reports --target eap", which successfully generates a report.
The issue is that when I open up index.html in reports, I get 0 matches from my 2 input files. I check the "Executed rules overview" tab, I cannot find my Java rules listed. I'm not sure what's going wrong or if I just missed something. I am able to successfully create XML based rules but the Java based rules do not seem to be working. Any help would be appreciated.