Add GitHub workflow
diff --git a/.github/workflows/maven-verify.yml b/.github/workflows/maven-verify.yml new file mode 100644 index 0000000..99811aa --- /dev/null +++ b/.github/workflows/maven-verify.yml
@@ -0,0 +1,31 @@ +# 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. + +name: Verify + +on: + push: + pull_request: + +jobs: + build: + name: Verify + uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v4 + with: + ff-maven: "4.0.0-beta-4" # Maven version for fail-fast-build + maven-matrix: '[ "4.0.0-beta-4" ]' + jdk-matrix: '[ "17", "21" ]'
diff --git a/pom.xml b/pom.xml index faead6c..0fe3752 100644 --- a/pom.xml +++ b/pom.xml
@@ -63,7 +63,7 @@ <dependency> <groupId>org.junit.jupiter</groupId> - <artifactId>junit-jupiter-api</artifactId> + <artifactId>junit-jupiter</artifactId> <version>${junit.version}</version> <scope>test</scope> </dependency> @@ -85,6 +85,7 @@ <configuration> <outputDirectory>${project.build.directory}/mdo</outputDirectory> <artifact>org.apache.maven:maven-api-model:${maven.version}:mdo</artifact> + <stripVersion>true</stripVersion> </configuration> </execution> </executions> @@ -104,7 +105,7 @@ <basedir>${project.build.directory}/mdo</basedir> <velocityBasedir>${project.basedir}/src/main/mdo</velocityBasedir> <models> - <model>maven-api-model-${maven.version}.mdo</model> + <model>maven-api-model.mdo</model> </models> <templates> <template>reader-stax.vm</template> @@ -132,27 +133,13 @@ <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-invoker-plugin</artifactId> - <version>3.7.0</version> + <version>3.8.0</version> <configuration> - <debug>true</debug> <showErrors>true</showErrors> - <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo> + <cloneProjectsTo>${project.build.directory}/its</cloneProjectsTo> <cloneClean>true</cloneClean> - <!-- <pomIncludes>--> - <!-- <pomInclude>*/pom.xml</pomInclude>--> - <!-- <pomInclude>*/non-default-pom.xml</pomInclude>--> - <!-- </pomIncludes>--> - <!-- <preBuildHookScript>setup</preBuildHookScript>--> - <!-- <postBuildHookScript>verify</postBuildHookScript>--> <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath> - <!-- <settingsFile>src/it/settings.xml</settingsFile>--> - <!-- <scriptVariables>--> - <!-- <remoteRepo>${project.build.directory}/remote-repo</remoteRepo>--> - <!-- </scriptVariables>--> - <!-- <filterProperties>--> - <!-- <remoteRepo>${project.build.directory}/remote-repo</remoteRepo>--> - <!-- </filterProperties>--> - <pom>src/it/entities-xinclude/pom.xml</pom> + <settingsFile>src/it/settings.xml</settingsFile> </configuration> </plugin> </plugins>
diff --git a/src/it/entities-xinclude/.mvn/extensions.xml b/src/it/entities-xinclude/.mvn/extensions.xml new file mode 100644 index 0000000..aff9faa --- /dev/null +++ b/src/it/entities-xinclude/.mvn/extensions.xml
@@ -0,0 +1,26 @@ +<?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. +--> +<extensions> + <extension> + <groupId>org.apache.maven.extensions</groupId> + <artifactId>maven-xinclude-extension</artifactId> + <version>@project.version@</version> + </extension> +</extensions> \ No newline at end of file
diff --git a/src/it/entities-xinclude/child/pom.xml b/src/it/entities-xinclude/child/pom.xml new file mode 100644 index 0000000..937dc68 --- /dev/null +++ b/src/it/entities-xinclude/child/pom.xml
@@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Copyright 2019-2023 the original author or authors. + + Licensed 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. + +--> +<!DOCTYPE foo SYSTEM "../foo.dtd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:xi="http://www.w3.org/2001/XInclude" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd + http://www.w3.org/2001/XInclude https://www.w3.org/2001/XInclude/XInclude.xsd"> + + + <modelVersion>4.0.0</modelVersion> + + <xi:include href="../snippets.xml" xpointer="id-parent" /> + + <groupId>&groupId;</groupId> + <artifactId>child</artifactId> + &version; + <packaging>jar</packaging> + +</project> \ No newline at end of file
diff --git a/src/it/entities-xinclude/foo.dtd b/src/it/entities-xinclude/foo.dtd new file mode 100644 index 0000000..a854e4a --- /dev/null +++ b/src/it/entities-xinclude/foo.dtd
@@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Copyright 2019-2023 the original author or authors. + + Licensed 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. + +--> +<!ENTITY version SYSTEM "version.xml"> +<!ENTITY groupId "org.apache.maven.it5862">
diff --git a/src/it/entities-xinclude/pom.xml b/src/it/entities-xinclude/pom.xml new file mode 100644 index 0000000..14c4998 --- /dev/null +++ b/src/it/entities-xinclude/pom.xml
@@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Copyright 2019-2023 the original author or authors. + + Licensed 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. + +--> +<!DOCTYPE foo SYSTEM "foo.dtd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:xi="http://www.w3.org/2001/XInclude" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd + http://www.w3.org/2001/XInclude https://www.w3.org/2001/XInclude/XInclude.xsd"> + + + <modelVersion>4.0.0</modelVersion> + + <groupId>&groupId;</groupId> + <artifactId>parent</artifactId> + &version; + + <packaging>pom</packaging> + + <modules> + <module>child</module> + </modules> + +</project> \ No newline at end of file
diff --git a/src/it/entities-xinclude/snippets.xml b/src/it/entities-xinclude/snippets.xml new file mode 100644 index 0000000..04f7250 --- /dev/null +++ b/src/it/entities-xinclude/snippets.xml
@@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Copyright 2019-2023 the original author or authors. + + Licensed 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. + +--> +<!DOCTYPE foo [ + <!ENTITY version SYSTEM "version.xml"> + <!ENTITY groupId "org.apache.maven.it5862"> +]> +<snippets> + + <parent xml:id="id-parent"> + <groupId>&groupId;</groupId> + <artifactId>parent</artifactId> + &version; + </parent> + +</snippets> \ No newline at end of file
diff --git a/src/it/entities-xinclude/version.xml b/src/it/entities-xinclude/version.xml new file mode 100644 index 0000000..d0d54b0 --- /dev/null +++ b/src/it/entities-xinclude/version.xml
@@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + Copyright 2019-2023 the original author or authors. + + Licensed 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. + +--> +<version>1.0-SNAPSHOT</version> \ No newline at end of file
diff --git a/src/it/settings.xml b/src/it/settings.xml new file mode 100644 index 0000000..0317296 --- /dev/null +++ b/src/it/settings.xml
@@ -0,0 +1,25 @@ +<?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 xmlns="http://maven.apache.org/SETTINGS/1.3.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.3.0 https://maven.apache.org/xsd/settings-1.3.0.xsd"> +</settings> \ No newline at end of file
diff --git a/src/main/java/org/apache/maven/xinclude/XIncludeModelXmlFactory.java b/src/main/java/org/apache/maven/xinclude/XIncludeModelXmlFactory.java index c04841d..59051f3 100644 --- a/src/main/java/org/apache/maven/xinclude/XIncludeModelXmlFactory.java +++ b/src/main/java/org/apache/maven/xinclude/XIncludeModelXmlFactory.java
@@ -46,7 +46,7 @@ import static org.apache.maven.internal.impl.StaxLocation.getLocation; import static org.apache.maven.internal.impl.StaxLocation.getMessage; -import static org.apache.maven.xinclude.Utils.*; +import static org.apache.maven.xinclude.Utils.nonNull; @Named @Singleton
diff --git a/src/main/java/org/apache/maven/xinclude/stax/XIncludeStreamReader.java b/src/main/java/org/apache/maven/xinclude/stax/XIncludeStreamReader.java index e36c4b1..8c5fa59 100644 --- a/src/main/java/org/apache/maven/xinclude/stax/XIncludeStreamReader.java +++ b/src/main/java/org/apache/maven/xinclude/stax/XIncludeStreamReader.java
@@ -137,6 +137,7 @@ return event; } + @SuppressWarnings({"checkstyle:MethodLength", "checkstyle:UnusedLocalVariable"}) private void processInclude() throws XMLStreamException { Location startLocation = this.getLocation();
diff --git a/src/main/java/org/apache/maven/xinclude/stax/XPointerParser.java b/src/main/java/org/apache/maven/xinclude/stax/XPointerParser.java index 3a5cbdd..f5a4778 100644 --- a/src/main/java/org/apache/maven/xinclude/stax/XPointerParser.java +++ b/src/main/java/org/apache/maven/xinclude/stax/XPointerParser.java
@@ -329,6 +329,7 @@ /** * Scans the XPointer Expression */ + @SuppressWarnings("checkstyle:MethodLength") private static boolean scanExpr(Tokens tokens, String data, int currentOffset, int endOffset) throws InvalidXPointerException { int ch;