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

Issue #417: BOM should not inherit build setup from parent POM #418

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
4 changes: 2 additions & 2 deletions PearPackagingMavenPlugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@

<parent>
<groupId>org.apache.uima</groupId>
<artifactId>uimaj-parent</artifactId>
<artifactId>uimaj-parent-internal</artifactId>
<version>3.6.0-SNAPSHOT</version>
<relativePath>../uimaj-parent/pom.xml</relativePath>
<relativePath>../uimaj-parent-internal/pom.xml</relativePath>
</parent>

<artifactId>PearPackagingMavenPlugin</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions aggregate-uimaj-eclipse-plugins/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@

<parent>
<groupId>org.apache.uima</groupId>
<artifactId>uimaj-parent</artifactId>
<artifactId>uimaj-parent-internal</artifactId>
<version>3.6.0-SNAPSHOT</version>
<relativePath>../uimaj-parent/pom.xml</relativePath>
<relativePath>../uimaj-parent-internal/pom.xml</relativePath>
</parent>

<artifactId>aggregate-uimaj-eclipse-plugins</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions aggregate-uimaj/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@

<parent>
<groupId>org.apache.uima</groupId>
<artifactId>uimaj-parent</artifactId>
<artifactId>uimaj-parent-internal</artifactId>
<version>3.6.0-SNAPSHOT</version>
<relativePath>../uimaj-parent/pom.xml</relativePath>
<relativePath>../uimaj-parent-internal/pom.xml</relativePath>
</parent>

<artifactId>aggregate-uimaj</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions jVinci/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@

<parent>
<groupId>org.apache.uima</groupId>
<artifactId>uimaj-parent</artifactId>
<artifactId>uimaj-parent-internal</artifactId>
<version>3.6.0-SNAPSHOT</version>
<relativePath>../uimaj-parent/pom.xml</relativePath>
<relativePath>../uimaj-parent-internal/pom.xml</relativePath>
</parent>

<artifactId>jVinci</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions jcasgen-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.uima</groupId>
<artifactId>uimaj-parent</artifactId>
<artifactId>uimaj-parent-internal</artifactId>
<version>3.6.0-SNAPSHOT</version>
<relativePath>../uimaj-parent/pom.xml</relativePath>
<relativePath>../uimaj-parent-internal/pom.xml</relativePath>
</parent>

<!-- This artifact name follows the conventions described
Expand Down
71 changes: 36 additions & 35 deletions jcasgen-maven-plugin/src/it/simple/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,43 +16,44 @@
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>
<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>test</groupId>
<artifactId>simple</artifactId>
<version>1.0.0-SNAPSHOT</version>
<properties>
<groupId>test</groupId>
<artifactId>simple</artifactId>
<version>1.0.0-SNAPSHOT</version>
<properties>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.uima</groupId>
<artifactId>jcasgen-maven-plugin</artifactId>
<version>@project.version@</version>
<configuration>
<typeSystemIncludes>
<typeSystemInclude>src/main/resources/TypeSystem.xml</typeSystemInclude>
</typeSystemIncludes>
</configuration>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.uima</groupId>
<artifactId>uimaj-core</artifactId>
<version>@project.version@</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.uima</groupId>
<artifactId>jcasgen-maven-plugin</artifactId>
<version>@project.version@</version>
<configuration>
<typeSystemIncludes>
<typeSystemInclude>src/main/resources/TypeSystem.xml</typeSystemInclude>
</typeSystemIncludes>
</configuration>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.uima</groupId>
<artifactId>uimaj-core</artifactId>
<version>@project.version@</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -19,80 +19,58 @@
package org.apache.uima.tools.jcasgen.maven;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import org.apache.maven.execution.DefaultMavenExecutionRequest;
import org.apache.maven.execution.MavenExecutionRequest;
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 org.apache.maven.repository.internal.MavenRepositorySystemUtils;

import org.apache.maven.plugin.testing.MojoRule;
import org.codehaus.plexus.util.DirectoryScanner;
import org.codehaus.plexus.util.FileUtils;
import org.eclipse.aether.RepositorySystemSession;
import org.junit.Rule;
import org.junit.Test;

public class JCasGenMojoTest extends AbstractMojoTestCase {
public class JCasGenMojoTest {

public @Rule MojoRule rule = new MojoRule();

@Test
public void testInvalidFeature() throws Exception {
Exception ee = null;
try {
assertThatExceptionOfType(Exception.class).isThrownBy(() -> {
this.test("invalidFeature");
} catch (Exception e) {
ee = e;
}
assertTrue(ee != null);
assertEquals(
"JCasGen: The feature name 'type', specified in Type 'type.span.Sentence' is reserved. Please choose another name.",
ee.getMessage());
}).withMessage(
"JCasGen: The feature name 'type', specified in Type 'type.span.Sentence' is reserved. Please choose another name.");
}

@Test
public void testSimple() throws Exception {
this.test("simple", "type.span.Sentence", "type.span.Token", "type.relation.Dependency");
test("simple", "type.span.Sentence", "type.span.Token", "type.relation.Dependency");
}

@Test
public void testClasspath() throws Exception {
this.test("classpath", "type.span.Sentence", "type.span.Token", "type.relation.Dependency");
test("classpath", "type.span.Sentence", "type.span.Token", "type.relation.Dependency");
}

@Test
public void testWildcard() throws Exception {
this.test("wildcard", "type.span.Sentence", "type.span.Token");
test("wildcard", "type.span.Sentence", "type.span.Token");
}

@Test
public void testExclude() throws Exception {
this.test("exclude", "type.span.Sentence");
test("exclude", "type.span.Sentence");
}

@Test
public void test(String projectName, String... types) throws Exception {
private void test(String projectName, String... types) throws Exception {

File projectSourceDirectory = getTestFile("src/test/resources/" + projectName);
File projectDirectory = getTestFile("target/project-" + projectName + "-test");
var projectSourceDirectory = new File("src/test/resources/" + projectName);
var projectDirectory = new File("target/project-" + projectName + "-test");

// Stage project to target folder
FileUtils.copyDirectoryStructure(projectSourceDirectory, projectDirectory);

File pomFile = new File(projectDirectory, "/pom.xml");
assertNotNull(pomFile);
assertTrue(pomFile.exists());

// create the MavenProject from the pom.xml file
RepositorySystemSession session = MavenRepositorySystemUtils.newSession();
MavenExecutionRequest executionRequest = new DefaultMavenExecutionRequest();
ProjectBuildingRequest buildingRequest = executionRequest.getProjectBuildingRequest();
buildingRequest.setRepositorySession(session);
ProjectBuilder projectBuilder = this.lookup(ProjectBuilder.class);
MavenProject project = projectBuilder.build(pomFile, buildingRequest).getProject();
assertNotNull(project);
var project = rule.readMavenProject(projectDirectory);

// copy resources
File source = new File(projectDirectory, "src/main/resources");
Expand All @@ -101,11 +79,11 @@ public void test(String projectName, String... types) throws Exception {
}

// load the Mojo
JCasGenMojo generate = (JCasGenMojo) this.lookupConfiguredMojo(project, "generate");
assertNotNull(generate);
var generate = (JCasGenMojo) rule.lookupConfiguredMojo(project, "generate");
assertThat(generate).isNotNull();

// set the MavenProject on the Mojo (AbstractMojoTestCase does not do this by default)
setVariableValueToObject(generate, "project", project);
rule.setVariableValueToObject(generate, "project", project);

// execute the Mojo
generate.execute();
Expand All @@ -114,17 +92,18 @@ public void test(String projectName, String... types) throws Exception {
File jCasGenDirectory = new File(project.getBasedir(), "target/generated-sources/jcasgen");

// Record all the files that were generated
DirectoryScanner ds = new DirectoryScanner();
var ds = new DirectoryScanner();
ds.setBasedir(jCasGenDirectory);
ds.setIncludes(new String[] { "**/*.java" });
ds.scan();
List<File> files = new ArrayList<>();
for (String scannedFile : ds.getIncludedFiles()) {

var files = new ArrayList<File>();
for (var scannedFile : ds.getIncludedFiles()) {
files.add(new File(ds.getBasedir(), scannedFile));
}

for (String type : types) {
File wrapperFile = new File(jCasGenDirectory + "/" + type.replace('.', '/') + ".java");
for (var type : types) {
var wrapperFile = new File(jCasGenDirectory + "/" + type.replace('.', '/') + ".java");
// no _type files in v3
// File typeFile = new File(jCasGenDirectory + "/" + type.replace('.', '/') + "_Type.java");

Expand Down
7 changes: 4 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@

<parent>
<groupId>org.apache.uima</groupId>
<artifactId>uimaj-parent</artifactId>
<artifactId>uimaj-parent-internal</artifactId>
<version>3.6.0-SNAPSHOT</version>
<relativePath>uimaj-parent/pom.xml</relativePath>
<relativePath>uimaj-parent-internal/pom.xml</relativePath>
</parent>

<artifactId>uimaj</artifactId>
Expand All @@ -52,8 +52,9 @@
</properties>

<modules>
<module>uimaj-bom</module>
<module>uimaj-parent</module>
<module>uimaj-bom</module>
<module>uimaj-parent-internal</module>
<module>aggregate-uimaj</module>
</modules>

Expand Down
4 changes: 2 additions & 2 deletions uima-bnd-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@

<parent>
<groupId>org.apache.uima</groupId>
<artifactId>uimaj-parent</artifactId>
<artifactId>uimaj-parent-internal</artifactId>
<version>3.6.0-SNAPSHOT</version>
<relativePath>../uimaj-parent/pom.xml</relativePath>
<relativePath>../uimaj-parent-internal/pom.xml</relativePath>
</parent>

<artifactId>uima-bnd-plugin</artifactId>
Expand Down
6 changes: 3 additions & 3 deletions uimafit-assertj/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@

<parent>
<groupId>org.apache.uima</groupId>
<artifactId>uimaj-parent</artifactId>
<artifactId>uimaj-parent-internal</artifactId>
<version>3.6.0-SNAPSHOT</version>
<relativePath>../uimaj-parent/pom.xml</relativePath>
<relativePath>../uimaj-parent-internal/pom.xml</relativePath>
</parent>

<artifactId>uimafit-assertj</artifactId>
<packaging>bundle</packaging>

<name>Apache UIMA uimaFIT - AssertJ support</name>
<name>Apache UIMA uimaFIT: AssertJ support</name>

<dependencies>
<dependency>
Expand Down
6 changes: 3 additions & 3 deletions uimafit-benchmark/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@

<parent>
<groupId>org.apache.uima</groupId>
<artifactId>uimaj-parent</artifactId>
<artifactId>uimaj-parent-internal</artifactId>
<version>3.6.0-SNAPSHOT</version>
<relativePath>../uimaj-parent/pom.xml</relativePath>
<relativePath>../uimaj-parent-internal/pom.xml</relativePath>
</parent>

<artifactId>uimafit-benchmark</artifactId>
<packaging>jar</packaging>
<name>Apache UIMA uimaFIT - Benchmark</name>
<name>Apache UIMA uimaFIT: Benchmark</name>
<description>Factories, Injection, and Testing library for UIMA</description>
<url>${uimaWebsiteUrl}</url>

Expand Down
6 changes: 3 additions & 3 deletions uimafit-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@

<parent>
<groupId>org.apache.uima</groupId>
<artifactId>uimaj-parent</artifactId>
<artifactId>uimaj-parent-internal</artifactId>
<version>3.6.0-SNAPSHOT</version>
<relativePath>../uimaj-parent/pom.xml</relativePath>
<relativePath>../uimaj-parent-internal/pom.xml</relativePath>
</parent>

<artifactId>uimafit-core</artifactId>
<packaging>bundle</packaging>

<name>Apache UIMA uimaFIT - Core</name>
<name>Apache UIMA uimaFIT: Core</name>
<description>Factories, Injection, and Testing library for UIMA</description>
<url>${uimaWebsiteUrl}</url>

Expand Down
6 changes: 3 additions & 3 deletions uimafit-cpe/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@

<parent>
<groupId>org.apache.uima</groupId>
<artifactId>uimaj-parent</artifactId>
<artifactId>uimaj-parent-internal</artifactId>
<version>3.6.0-SNAPSHOT</version>
<relativePath>../uimaj-parent/pom.xml</relativePath>
<relativePath>../uimaj-parent-internal/pom.xml</relativePath>
</parent>

<artifactId>uimafit-cpe</artifactId>
<packaging>bundle</packaging>

<name>Apache UIMA uimaFIT - Collection Processing Engine support</name>
<name>Apache UIMA uimaFIT: Collection Processing Engine support</name>

<dependencies>
<dependency>
Expand Down
Loading