This is an automated email from the ASF dual-hosted git repository. adangel pushed a commit to branch MPMD-318 in repository https://gitbox.apache.org/repos/asf/maven-pmd-plugin.git
commit 7b82d6ddb1f75af50565d4fa37766909f1474ada Author: Andreas Dangel <adan...@apache.org> AuthorDate: Fri Jul 23 15:18:56 2021 +0200 [MPMD-318] Add it for incorrect auxclasspath with includeTests --- .../invoker.properties | 21 ++++++++ .../module-a/pom.xml | 47 +++++++++++++++++ .../module-a/src/main/java/module/a/ModuleA.java | 24 +++++++++ .../src/test/java/module/a/ModuleATest.java | 24 +++++++++ src/it/MPMD-318-auxclasspath-includeTests/pom.xml | 61 ++++++++++++++++++++++ .../verify.groovy | 42 +++++++++++++++ 6 files changed, 219 insertions(+) diff --git a/src/it/MPMD-318-auxclasspath-includeTests/invoker.properties b/src/it/MPMD-318-auxclasspath-includeTests/invoker.properties new file mode 100644 index 0000000..85a3ada --- /dev/null +++ b/src/it/MPMD-318-auxclasspath-includeTests/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 = clean verify +invoker.goals.2 = clean verify -Daggregate=true +invoker.maven.version = 3+ +invoker.debug = true diff --git a/src/it/MPMD-318-auxclasspath-includeTests/module-a/pom.xml b/src/it/MPMD-318-auxclasspath-includeTests/module-a/pom.xml new file mode 100644 index 0000000..0374658 --- /dev/null +++ b/src/it/MPMD-318-auxclasspath-includeTests/module-a/pom.xml @@ -0,0 +1,47 @@ +<?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> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.apache.maven.plugins.pmd.it</groupId> + <artifactId>MPMD-318-auxclasspath-includeTests</artifactId> + <version>1.0-SNAPSHOT</version> + </parent> + + <artifactId>MPMD-318-auxclasspath-includeTests-module-a</artifactId> + + <dependencies> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + <version>3.8.1</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + <version>2.6</version> + <scope>test</scope> + </dependency> + </dependencies> +</project> diff --git a/src/it/MPMD-318-auxclasspath-includeTests/module-a/src/main/java/module/a/ModuleA.java b/src/it/MPMD-318-auxclasspath-includeTests/module-a/src/main/java/module/a/ModuleA.java new file mode 100644 index 0000000..a407af5 --- /dev/null +++ b/src/it/MPMD-318-auxclasspath-includeTests/module-a/src/main/java/module/a/ModuleA.java @@ -0,0 +1,24 @@ +package module.a; + +/* + * 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. + */ + +public class ModuleA +{ +} \ No newline at end of file diff --git a/src/it/MPMD-318-auxclasspath-includeTests/module-a/src/test/java/module/a/ModuleATest.java b/src/it/MPMD-318-auxclasspath-includeTests/module-a/src/test/java/module/a/ModuleATest.java new file mode 100644 index 0000000..06b757f --- /dev/null +++ b/src/it/MPMD-318-auxclasspath-includeTests/module-a/src/test/java/module/a/ModuleATest.java @@ -0,0 +1,24 @@ +package module.a; + +/* + * 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. + */ + +public class ModuleATest +{ +} \ No newline at end of file diff --git a/src/it/MPMD-318-auxclasspath-includeTests/pom.xml b/src/it/MPMD-318-auxclasspath-includeTests/pom.xml new file mode 100644 index 0000000..f10c3ff --- /dev/null +++ b/src/it/MPMD-318-auxclasspath-includeTests/pom.xml @@ -0,0 +1,61 @@ +<?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> + <modelVersion>4.0.0</modelVersion> + + <groupId>org.apache.maven.plugins.pmd.it</groupId> + <artifactId>MPMD-318-auxclasspath-includeTests</artifactId> + <version>1.0-SNAPSHOT</version> + <packaging>pom</packaging> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <maven.compiler.source>1.8</maven.compiler.source> + <maven.compiler.target>1.8</maven.compiler.target> + </properties> + + <modules> + <module>module-a</module> + </modules> + + <build> + <plugins> + <plugin> + <groupId>@project.groupId@</groupId> + <artifactId>@project.artifactId@</artifactId> + <version>@project.version@</version> + <configuration> + <linkXRef>false</linkXRef> + <typeResolution>true</typeResolution> + <includeTests>true</includeTests> + </configuration> + <executions> + <execution> + <goals> + <goal>check</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/src/it/MPMD-318-auxclasspath-includeTests/verify.groovy b/src/it/MPMD-318-auxclasspath-includeTests/verify.groovy new file mode 100644 index 0000000..b24bd87 --- /dev/null +++ b/src/it/MPMD-318-auxclasspath-includeTests/verify.groovy @@ -0,0 +1,42 @@ +/* + * 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. + */ + +File buildLog = new File( basedir, 'build.log' ) +assert buildLog.exists() + +def auxclasspathLog = '' +for ( String line : buildLog.readLines() ) { + if ( line.contains( 'aux classpath:' ) ) { + auxclasspathLog += line + '\n'; + } +} + +// convert windows path names +auxclasspathLog = auxclasspathLog.replaceAll('\\\\', '/') + +assert 1 == auxclasspathLog.count( 'Using aux classpath:' ) +assert 1 == auxclasspathLog.count( 'Using aggregated aux classpath:' ) + +assert 2 == auxclasspathLog.count( 'module-a/target/test-classes' ) +assert 2 == auxclasspathLog.count( 'module-a/target/classes' ) + +// compile +assert 2 == auxclasspathLog.count( 'org/apache/commons/commons-lang3/3.8.1/commons-lang3-3.8.1.jar' ) +// test +assert 2 == auxclasspathLog.count( 'commons-io/commons-io/2.6/commons-io-2.6.jar' )