maven - In what lifecycle point are tests ignored when building? -
i trying understand maven build lifecycle when regarding tests: let's have project class in src/main folder , 1 in src/test. when run mvn install, get's compiled, tested, packaged , installed.
until thought maven not package tests in snapshot, because not "production" code. true? in case, when maven ignores test files?
what said maven lifecycle true. "main" phases include:
compile: in phase,maven-compiler-plugin:compilegoal run compiles main code of project.test-compile: in phase,maven-compiler-plugin:testcompilegoal run compiles test code of project.test: in phase,maven-surefire-plugin:testgoal run , unit tests executed.package: in phase,maven-jar-plugin:jargoal run , creates jar of current project. default, jar include classes undertarget/classes, contains main classes, not test classes located insidetarget/test-classes. @ step maven ignores test classes.install: in phase,maven-install-plugin:installinstall main artifact, , every attached artifact, local repository.
to answer more precisely, it's not maven ignores test classes, default, packaging process considers main classes. can configure package test classes maven-jar-plugin:test-jar goal inside attached artifact.
Comments
Post a Comment