Skip to content

Commit

Permalink
fix generation of kjar with executable model + sample project
Browse files Browse the repository at this point in the history
  • Loading branch information
mariofusco committed Dec 14, 2017
1 parent 55fb462 commit a9a2959
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 17 deletions.
Expand Up @@ -13,7 +13,7 @@
* limitations under the License.
*/

package org.kie.sample.model;
package org.kie.firealarm;

public class Fire {

Expand Down
Expand Up @@ -13,7 +13,7 @@
* limitations under the License.
*/

package org.kie.sample.model;
package org.kie.firealarm;

public class Room {

Expand Down
Expand Up @@ -13,7 +13,7 @@
* limitations under the License.
*/

package org.kie.sample.model;
package org.kie.firealarm;

public class Sprinkler {

Expand Down
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<kmodule xmlns="http://jboss.org/kie/6.0.0/kmodule">
<kbase name="KBase1" packages="KBase1">
<kbase name="KBase1" packages="org.kie.example">
<ksession name="KBase1.session" type="stateful"/>
</kbase>
<kbase name="FireAlarmKBase" packages="FireAlarmKBase">
<kbase name="FireAlarmKBase" packages="org.kie.firealarm">
<ksession name="FireAlarmKBase.session" type="stateful"/>
</kbase>
</kmodule>
Expand Up @@ -13,7 +13,7 @@
* limitations under the License.
*/

package org.kie.test
package org.kie.example
declare FactA
fieldB: FactB
end
Expand Up @@ -13,7 +13,7 @@
* limitations under the License.
*/

package org.kie.test
package org.kie.example
declare FactB
fieldA: FactA
end
Expand Up @@ -13,7 +13,7 @@
* limitations under the License.
*/

package org.kie.test
package org.kie.example
rule R1 when
$fieldA : FactA( $fieldB : fieldB )
FactB( this == $fieldB, fieldA == $fieldA )
Expand Down
Expand Up @@ -13,6 +13,6 @@
* limitations under the License.
*/

package org.kie.sample.model
package org.kie.firealarm
declare Alarm
end
Expand Up @@ -13,10 +13,10 @@
* limitations under the License.
*/

package org.kie.sample
package org.kie.firealarm

import java.util.*
import org.kie.sample.model.*
import org.kie.firealarm.*

rule "When there is a fire turn on the sprinkler"
when
Expand Down
Expand Up @@ -13,10 +13,10 @@
* limitations under the License.
*/

package org.kie.sample
package org.kie.firealarm

import java.util.*
import org.kie.sample.model.*
import org.kie.firealarm.*

rule "Raise the alarm when we have one or more fires"
when
Expand Down
Expand Up @@ -21,9 +21,9 @@
import org.kie.api.runtime.KieContainer;
import org.kie.api.runtime.KieSession;
import org.kie.api.runtime.rule.FactHandle;
import org.kie.sample.model.Fire;
import org.kie.sample.model.Room;
import org.kie.sample.model.Sprinkler;
import org.kie.firealarm.Fire;
import org.kie.firealarm.Room;
import org.kie.firealarm.Sprinkler;

import static org.junit.Assert.assertEquals;

Expand Down
Expand Up @@ -162,9 +162,11 @@ private void generateModel() throws MojoExecutionException {

// copy the META-INF packages file
final MemoryFile packagesMemoryFile = (MemoryFile) mfs.getFile(CanonicalKieModule.MODEL_FILE);
final Path packagesDestinationPath = Paths.get(targetDirectory.getPath(), "classes", "META-INF", packagesMemoryFile.getName());
final String packagesMemoryFilePath = packagesMemoryFile.getFolder().getPath().toPortableString();
final Path packagesDestinationPath = Paths.get(targetDirectory.getPath(), "classes", packagesMemoryFilePath, packagesMemoryFile.getName());

try {
Files.createDirectories( packagesDestinationPath );
Files.copy(packagesMemoryFile.getContents(), packagesDestinationPath, StandardCopyOption.REPLACE_EXISTING);
} catch (IOException e) {
e.printStackTrace();
Expand Down

0 comments on commit a9a2959

Please sign in to comment.