-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[KIE-726] create a maven archetype for rules in yaml format (#5595)
- Loading branch information
1 parent
13edb2c
commit 75871b8
Showing
26 changed files
with
1,202 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/target | ||
/local | ||
|
||
# Eclipse, Netbeans and IntelliJ files | ||
/.* | ||
!.gitignore | ||
/nbproject | ||
/*.ipr | ||
/*.iws | ||
/*.iml | ||
*.xpr | ||
|
||
# Repository wide ignore mac DS_Store files | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
<?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. | ||
--> | ||
<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.kie</groupId> | ||
<artifactId>kie-archetypes</artifactId> | ||
<version>8.45.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>kie-drools-yaml-archetype</artifactId> | ||
<packaging>maven-archetype</packaging> | ||
|
||
<name>KIE :: Drools Maven Archetype with Executable Model and YAML format rules</name> | ||
<description> | ||
Drools rule example with executable model and traditional API and rule style with rules in yaml format. | ||
Use property droolsVersion to specify which version of Drools to use in a generated project. | ||
</description> | ||
<url>http://drools.org</url> | ||
|
||
<properties> | ||
<dollar>$</dollar> | ||
</properties> | ||
|
||
<build> | ||
<resources> | ||
<resource> | ||
<directory>src/main/resources</directory> | ||
<filtering>true</filtering> | ||
</resource> | ||
</resources> | ||
<testResources> | ||
<testResource> | ||
<directory>src/test/resources</directory> | ||
<filtering>false</filtering> | ||
<excludes> | ||
<exclude>**/pom.xml</exclude> | ||
<exclude>**/archetype.properties</exclude> | ||
</excludes> | ||
</testResource> | ||
<testResource> | ||
<directory>src/test/resources</directory> | ||
<filtering>true</filtering> | ||
<includes> | ||
<include>**/pom.xml</include> | ||
<include>**/archetype.properties</include> | ||
</includes> | ||
</testResource> | ||
</testResources> | ||
|
||
<extensions> | ||
<extension> | ||
<groupId>org.apache.maven.archetype</groupId> | ||
<artifactId>archetype-packaging</artifactId> | ||
<version>3.2.1</version> | ||
</extension> | ||
</extensions> | ||
|
||
<pluginManagement> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-archetype-plugin</artifactId> | ||
<version>3.2.1</version> | ||
<configuration> | ||
<ignoreEOLStyle>true</ignoreEOLStyle> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</pluginManagement> | ||
</build> | ||
</project> |
71 changes: 71 additions & 0 deletions
71
...etypes/kie-drools-yaml-archetype/src/main/resources/META-INF/maven/archetype-metadata.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?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. | ||
--> | ||
<archetype-descriptor xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd" name="drools6test.asd" | ||
xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<requiredProperties> | ||
<requiredProperty key="droolsVersion"> | ||
<defaultValue>${project.version}</defaultValue> | ||
</requiredProperty> | ||
<requiredProperty key="slf4jVersion"> | ||
<defaultValue>${version.org.slf4j}</defaultValue> | ||
</requiredProperty> | ||
<requiredProperty key="junitVersion"> | ||
<defaultValue>${version.junit}</defaultValue> | ||
</requiredProperty> | ||
<requiredProperty key="logbackVersion"> | ||
<defaultValue>${version.ch.qos.logback}</defaultValue> | ||
</requiredProperty> | ||
</requiredProperties> | ||
<fileSets> | ||
<fileSet filtered="true" packaged="true" encoding="UTF-8"> | ||
<directory>src/main/java</directory> | ||
<includes> | ||
<include>**/*.java</include> | ||
</includes> | ||
</fileSet> | ||
<fileSet filtered="true" encoding="UTF-8"> | ||
<directory>src/main/resources</directory> | ||
<includes> | ||
<include>**/*.xml</include> | ||
</includes> | ||
</fileSet> | ||
<fileSet filtered="true" packaged="true" encoding="UTF-8"> | ||
<directory>src/main/resources</directory> | ||
<includes> | ||
<include>**/*.drl.yaml</include> | ||
</includes> | ||
</fileSet> | ||
<fileSet filtered="true" packaged="true" encoding="UTF-8"> | ||
<directory>src/test/java</directory> | ||
<includes> | ||
<include>**/*.java</include> | ||
</includes> | ||
</fileSet> | ||
<fileSet filtered="true" encoding="UTF-8"> | ||
<directory>src/test/resources</directory> | ||
<includes> | ||
<include>**/*.xml</include> | ||
</includes> | ||
</fileSet> | ||
</fileSets> | ||
</archetype-descriptor> |
100 changes: 100 additions & 0 deletions
100
kie-archetypes/kie-drools-yaml-archetype/src/main/resources/archetype-resources/pom.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
#set( $symbol_pound = '#' ) | ||
#set( $symbol_dollar = '$' ) | ||
#set( $symbol_escape = '\' ) | ||
<?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. | ||
--> | ||
<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>${dollar}{groupId}</groupId> | ||
<artifactId>${dollar}{artifactId}</artifactId> | ||
<version>${dollar}{version}</version> | ||
<packaging>kjar</packaging> | ||
|
||
<name>${dollar}{artifactId}</name> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<maven.compiler.release>11</maven.compiler.release> | ||
<drools-version>${droolsVersion}</drools-version> | ||
<slf4j-version>${slf4jVersion}</slf4j-version> | ||
<junit-version>${junitVersion}</junit-version> | ||
<logback-version>${logbackVersion}</logback-version> | ||
</properties> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.drools</groupId> | ||
<artifactId>drools-bom</artifactId> | ||
<type>pom</type> | ||
<version>${drools-version}</version> | ||
<scope>import</scope> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
|
||
<dependencies> | ||
|
||
<dependency> | ||
<groupId>org.drools</groupId> | ||
<artifactId>drools-engine</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.drools</groupId> | ||
<artifactId>drools-drlonyaml-todrl</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.drools</groupId> | ||
<artifactId>drools-xml-support</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>${junit-version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>ch.qos.logback</groupId> | ||
<artifactId>logback-classic</artifactId> | ||
<version>${logback-version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.8.1</version> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.kie</groupId> | ||
<artifactId>kie-maven-plugin</artifactId> | ||
<version>${drools-version}</version> | ||
<extensions>true</extensions> | ||
</plugin> | ||
</plugins> | ||
|
||
</build> | ||
</project> |
71 changes: 71 additions & 0 deletions
71
...ools-yaml-archetype/src/main/resources/archetype-resources/src/main/java/Measurement.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/** | ||
* 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. | ||
*/ | ||
#* | ||
* 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. | ||
*# | ||
#set( $symbol_pound = '#' ) | ||
#set( $symbol_dollar = '$' ) | ||
#set( $symbol_escape = '\' ) | ||
package ${package}; | ||
|
||
public class Measurement { | ||
private String id; | ||
private String val; | ||
|
||
public Measurement(String id, String val) { | ||
super(); | ||
this.id = id; | ||
this.val = val; | ||
} | ||
|
||
public String getId() { | ||
return id; | ||
} | ||
|
||
public String getVal() { | ||
return val; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
StringBuilder builder = new StringBuilder(); | ||
builder.append("Measurement ["); | ||
if (id != null) | ||
builder.append("id=").append(id).append(", "); | ||
if (val != null) | ||
builder.append("val=").append(val); | ||
builder.append("]"); | ||
return builder.toString(); | ||
} | ||
} |
Oops, something went wrong.