-
Notifications
You must be signed in to change notification settings - Fork 30
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
Processors should be considered as rightful dependencies #82
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
package se.kth.depclean; | ||
|
||
import static com.soebes.itf.extension.assertj.MavenITAssertions.assertThat; | ||
|
||
import com.soebes.itf.jupiter.extension.MavenGoal; | ||
import com.soebes.itf.jupiter.extension.MavenJupiterExtension; | ||
import com.soebes.itf.jupiter.extension.MavenTest; | ||
import com.soebes.itf.jupiter.maven.MavenExecutionResult; | ||
import org.junit.jupiter.api.DisplayName; | ||
|
||
import static com.soebes.itf.extension.assertj.MavenITAssertions.assertThat; | ||
|
||
/** | ||
* This class executes integration tests against the DepCleanMojo. The projects used for testing are in | ||
* src/test/resources-its/se/kth/depclean/DepCleanMojoIT. The results of the DepClean executions for each project are in | ||
|
@@ -19,11 +18,31 @@ | |
public class DepCleanMojoIT { | ||
|
||
@MavenTest | ||
@MavenGoal("package") | ||
@DisplayName("Test that DepClean runs in an empty Maven project") | ||
void empty_project(MavenExecutionResult result) { | ||
assertThat(result).isFailure(); // should pass | ||
} | ||
|
||
@MavenTest | ||
@DisplayName("Test that DepClean runs in a Maven project with processors") | ||
void processor_used(MavenExecutionResult result) { | ||
assertThat(result).isSuccessful().out() | ||
.plain().contains( | ||
"-------------------------------------------------------", | ||
" D E P C L E A N A N A L Y S I S R E S U L T S", | ||
"-------------------------------------------------------", | ||
"USED DIRECT DEPENDENCIES [1]: ", | ||
" org.mapstruct:mapstruct-processor:1.4.2.Final:provided (1 MB)", | ||
"USED INHERITED DEPENDENCIES [0]: ", | ||
"USED TRANSITIVE DEPENDENCIES [1]: ", | ||
" com.fasterxml.jackson.core:jackson-core:2.12.2:compile (356 KB)", | ||
"POTENTIALLY UNUSED DIRECT DEPENDENCIES [1]: ", | ||
" com.fasterxml.jackson.core:jackson-databind:2.12.2:compile (1 MB)", | ||
"POTENTIALLY UNUSED INHERITED DEPENDENCIES [0]: ", | ||
"POTENTIALLY UNUSED TRANSITIVE DEPENDENCIES [1]: ", | ||
" com.fasterxml.jackson.core:jackson-annotations:2.12.2:compile (73 KB)" | ||
); | ||
} | ||
|
||
} | ||
Comment on lines
+26
to
47
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice that you included a proper IT! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had a very hard time debugging the plugin though, maybe I'm doing something wrong... I was unable to catch a breakpoint in the core project. With more ITs, this big assertion can be refined, though. |
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>org.foo.bar</groupId> | ||
<artifactId>foobar</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
<name>foobar</name> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | ||
<maven.compiler.source>11</maven.compiler.source> | ||
<maven.compiler.target>11</maven.compiler.target> | ||
|
||
<mapstruct.version>1.4.2.Final</mapstruct.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.fasterxml.jackson.core</groupId> | ||
<artifactId>jackson-databind</artifactId> | ||
<version>2.12.2</version> | ||
<!--<scope>test</scope>--> | ||
</dependency> | ||
<!-- Include only this mapstruct dependency to fix issue #76 --> | ||
<dependency> | ||
<groupId>org.mapstruct</groupId> | ||
<artifactId>mapstruct-processor</artifactId> | ||
<version>${mapstruct.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>com.soebes.itf.jupiter.extension</groupId> | ||
<artifactId>itf-failure-plugin</artifactId> | ||
<version>0.9.0</version> | ||
<executions> | ||
<execution> | ||
<id>first_very_simple</id> | ||
<phase>initialize</phase> | ||
<goals> | ||
<goal>failure</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.bsc.maven</groupId> | ||
<artifactId>maven-processor-plugin</artifactId> | ||
<version>5.0-jdk8-rc1</version> | ||
<executions> | ||
<execution> | ||
<id>process</id> | ||
<goals> | ||
<goal>process</goal> | ||
</goals> | ||
<phase>generate-sources</phase> | ||
<configuration> | ||
<processors> | ||
<!-- Be sure to consider processors as rightful dependencies --> | ||
<processor>org.mapstruct.ap.MappingProcessor</processor> | ||
</processors> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>se.kth.castor</groupId> | ||
<artifactId>depclean-maven-plugin</artifactId> | ||
<version>${project.version}</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>depclean</goal> | ||
</goals> | ||
<!--<configuration>--> | ||
<!-- <failIfUnusedDirect>true</failIfUnusedDirect>--> | ||
<!-- <ignoreScopes>test,provided,import,runtime</ignoreScopes>--> | ||
<!--</configuration>--> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.core.util.Separators; | ||
|
||
|
||
public class Main { | ||
// private static final ObjectMapper converter = new ObjectMapper(); | ||
Separators separators = new Separators(); | ||
int field = 42; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this refactoring!
There are too many
null
in the project :)