This is an automated email from the ASF dual-hosted git repository. sjaranowski pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-invoker-plugin.git
The following commit(s) were added to refs/heads/master by this push: new 74a87f6 [MINVOKER-351] Escape special xml character in junit report (#242) 74a87f6 is described below commit 74a87f63712967d5c52c2ac00a16c0bb24e4ac45 Author: Slawomir Jaranowski <s.jaranow...@gmail.com> AuthorDate: Wed May 22 23:31:17 2024 +0200 [MINVOKER-351] Escape special xml character in junit report (#242) --------- Co-authored-by: Michael Osipov <micha...@apache.org> --- pom.xml | 13 +++ src/it/MINVOKER-351/invoker.properties | 21 +++++ src/it/MINVOKER-351/pom.xml | 92 ++++++++++++++++++++++ src/it/MINVOKER-351/src/it/minvoker-351/pom.xml | 35 ++++++++ .../src/it/minvoker-351/postbuild.groovy | 20 +++++ src/it/MINVOKER-351/verify.groovy | 31 ++++++++ 6 files changed, 212 insertions(+) diff --git a/pom.xml b/pom.xml index cc87562..a7c01d0 100644 --- a/pom.xml +++ b/pom.xml @@ -145,6 +145,12 @@ under the License. <version>${mavenVersion}</version> <scope>provided</scope> </dependency> + <dependency> + <groupId>org.apache.maven.resolver</groupId> + <artifactId>maven-resolver-api</artifactId> + <version>1.4.1</version> + <scope>provided</scope> + </dependency> <dependency> <groupId>org.apache.maven.resolver</groupId> <artifactId>maven-resolver-util</artifactId> @@ -205,6 +211,11 @@ under the License. <artifactId>maven-script-interpreter</artifactId> <version>1.6</version> </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <version>1.7.36</version> + </dependency> <dependency> <groupId>${beanshell-groupId}</groupId> @@ -236,6 +247,8 @@ under the License. <dependency> <groupId>org.codehaus.plexus</groupId> <artifactId>plexus-xml</artifactId> + <!-- TODO check with next parent --> + <version>3.0.1</version> </dependency> <dependency> <groupId>org.codehaus.plexus</groupId> diff --git a/src/it/MINVOKER-351/invoker.properties b/src/it/MINVOKER-351/invoker.properties new file mode 100644 index 0000000..d3ffde3 --- /dev/null +++ b/src/it/MINVOKER-351/invoker.properties @@ -0,0 +1,21 @@ +# 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. + +invoker.goals.1 = initialize +invoker.buildResult.1 = failure + +invoker.goals.2 = site diff --git a/src/it/MINVOKER-351/pom.xml b/src/it/MINVOKER-351/pom.xml new file mode 100644 index 0000000..a38261e --- /dev/null +++ b/src/it/MINVOKER-351/pom.xml @@ -0,0 +1,92 @@ +<?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>example.minvoker351</groupId> + <artifactId>minvoker-351</artifactId> + <version>1.0-SNAPSHOT</version> + <packaging>pom</packaging> + + <description>Special XML chars in build-job, junit reports</description> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <version.maven-compiler-plugin>@version.maven-compiler-plugin@</version.maven-compiler-plugin> + <version.maven-surefire>@version.maven-surefire@</version.maven-surefire> + </properties> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-site-plugin</artifactId> + <version>@version.maven-site-plugin@</version> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-invoker-plugin</artifactId> + <version>@project.version@</version> + <configuration> + <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo> + <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath> + <writeJunitReport>true</writeJunitReport> + </configuration> + <executions> + <execution> + <id>integration-test</id> + <phase>initialize</phase> + <goals> + <goal>install</goal> + <goal>run</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + + <!-- Run "mvn site" to see failure due to invalid XML characters --> + <reporting> + <excludeDefaults>true</excludeDefaults> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-report-plugin</artifactId> + <version>${version.maven-surefire}</version> + <configuration> + <reportsDirectories> + <reportsDirectory>${project.build.directory}/invoker-reports-test</reportsDirectory> + </reportsDirectories> + </configuration> + <reportSets> + <reportSet> + <reports> + <report>report-only</report> + </reports> + </reportSet> + </reportSets> + </plugin> + </plugins> + </reporting> +</project> diff --git a/src/it/MINVOKER-351/src/it/minvoker-351/pom.xml b/src/it/MINVOKER-351/src/it/minvoker-351/pom.xml new file mode 100644 index 0000000..1e327cb --- /dev/null +++ b/src/it/MINVOKER-351/src/it/minvoker-351/pom.xml @@ -0,0 +1,35 @@ +<?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>example.minvoker351</groupId> + <artifactId>minvoker-351</artifactId> + <version>1.0-SNAPSHOT</version> + <packaging>pom</packaging> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> + +</project> diff --git a/src/it/MINVOKER-351/src/it/minvoker-351/postbuild.groovy b/src/it/MINVOKER-351/src/it/minvoker-351/postbuild.groovy new file mode 100644 index 0000000..cc511ba --- /dev/null +++ b/src/it/MINVOKER-351/src/it/minvoker-351/postbuild.groovy @@ -0,0 +1,20 @@ +/* + * 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. + */ + +throw new Exception("Special chars \tcharName=" + Character.getName(7) + ": " + (char) 7) diff --git a/src/it/MINVOKER-351/verify.groovy b/src/it/MINVOKER-351/verify.groovy new file mode 100644 index 0000000..afc487b --- /dev/null +++ b/src/it/MINVOKER-351/verify.groovy @@ -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. + */ + +// we have a special chars in build.log +def buildLog = new File(basedir, 'target/it/minvoker-351/build.log').text +buildLog.contains('Special chars \tcharName=BEL: \u0007') + +def surefireReport = new File(basedir, 'target/site/surefire-report.html').text +assert surefireReport.contains('maven.invoker.it.minvoker-351') + +// TODO remove after next release +// Due to error parsing junit-reports by Jenkins with forbidden chars +new File(basedir, 'build.log').delete() + +return true \ No newline at end of file