Maven tries download multimodule dependency on `validate` phase - java

From a build pipeline I want to run validate phase for things like the enforcer plugin. However it does not work for a multimodule project as it tries to download dependencies from repository which are inside the project. However, compile phase does not do that, but for me it is not an option as it is too slow.
pom.xml:
<module>lib</module>
<module>app</module>
lib/pom.xml
<version>1.2.3</version>
app/pom.xml
<dependency>
<artifactId>lib</artifactId>
<version>1.2.3</version>
</dependency>
So, if I do mvn compile it works fine.
But if I do mvn validate it fails validating app module as it tries to download lib-1.2.3 from maven repo. For some reason it now could not see that the lib is a neighbour dependency. Why?
I have created a small repo: https://github.com/kan-izh/so63963768
mvn compile
[INFO] --- maven-enforcer-plugin:3.0.0-M3:enforce (enforce-no-snapshots) # app ---
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) # app ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Workspace\repo\so63963768\app\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) # app ---
[INFO] No sources to compile
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] parent ............................................ SUCCESS [1.612s]
[INFO] lib ............................................... SUCCESS [1.224s]
[INFO] app ............................................... SUCCESS [0.056s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
mvn validate
[INFO] --- maven-enforcer-plugin:3.0.0-M3:enforce (enforce-no-snapshots) # app ---
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] parent ............................................ SUCCESS [0.979s]
[INFO] lib ............................................... SUCCESS [0.015s]
[INFO] app ............................................... FAILURE [0.020s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.180s
[INFO] Finished at: Wed Sep 23 11:27:38 BST 2020
[INFO] Final Memory: 7M/34M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M3:enforce (enforce-no-snapshots) on project app: Execution
enforce-no-snapshots of goal org.apache.maven.plugins:maven-enforcer-plugin:3.0.0-M3:enforce failed: org.apache.maven.shared.dependency.graph.
DependencyGraphBuilderException: Could not resolve following dependencies: [com.so.q63963768:lib:jar:1.2.3 (compile)]: Could not resolve depend
encies for project com.so.q63963768:app:jar:1.2.3: Failure to find com.so.q63963768:lib:jar:1.2.3 in http://xxxxxxxxxxxxx.xx.xxxxxxxxxxxxxxxxx.
com:8081/repository/maven-public/ was cached in the local repository, resolution will not be reattempted until the update interval of nexus has
elapsed or updates are forced -> [Help 1]

This is a good question, and it shows a small flaw in how Maven handles dependencies.
You need to know that for every plugin-goal you can define if dependencies should be resolved, and for which scope. (and there's a small difference if having only the poms is enough, or that you also need the artifacts)
compiler:compile requires the dependencies that are required during compile, compiler:testCompile requires the dependencies that are required during test.
For the enforce goal it is tricky: the goal itself doesn't require to have resolved dependencies, nor do most rules( like requireJavaVersion or requireMavenVersion), but some rules do, like the one you try to enforce.
Ideally rules can define if they need to have resolved dependencies, but right now the API doesn't support that.
So you have a couple of solutions: always run with compile, or have an execution-block bound to the compile-pahse if it requires artifacts.

Related

Oracle ojdbc8 12.2.0.1 Forbidden by Maven

Oracle ojdbc8 12.2.0.1 Forbidden by Maven since December 2017, before that worked well. What configuration has changed on the Oracle repository (setting.xml)?
Maven project: https://github.com/sgrillon14/MavenSampleOracleJdbc
Full trace: https://travis-ci.org/sgrillon14/MavenSampleOracleJdbc
This is from the Maven Central Repository. Please try with these maven settings in your pom file to pull from the Maven Repository. The Group Id is different.
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
<version>12.2.0.1</version>
</dependency>
Since Oracle JDBC Driver is not in Maven repository, Download ojdbc8.jar and run the below command.
mvn install:install-file -Dfile=/home/cm/Videos/ojdbc8.jar -DgroupId=com.oracle -DartifactId=ojdbc8 -Dversion=12.1.0.2 -Dpackaging=jar
Add this dependency in pom.xml
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc8</artifactId>
<version>12.1.0.2</version>
</dependency>
It's possible that the Oracle Maven terms have changed. You may need to re-register on the Oracle Maven site: http://www.oracle.com/webapps/maven/register/license.html
I tried your github script and it worked fine with me:
$ mvn clean install --settings test/mvnsettings.xml
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building mavensampleoraclejdbc 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # mavensampleoraclejdbc ---
[INFO] Deleting /Users/jean/Downloads/MavenOracle/MavenSampleOracleJdbc-master/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # mavensampleoraclejdbc ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/jean/Downloads/MavenOracle/MavenSampleOracleJdbc-master/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # mavensampleoraclejdbc ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # mavensampleoraclejdbc ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/jean/Downloads/MavenOracle/MavenSampleOracleJdbc-master/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # mavensampleoraclejdbc ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # mavensampleoraclejdbc ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) # mavensampleoraclejdbc ---
[WARNING] JAR will be empty - no content was marked for inclusion!
[INFO] Building jar: /Users/jean/Downloads/MavenOracle/MavenSampleOracleJdbc-master/target/mavensampleoraclejdbc-1.0.0-SNAPSHOT.jar
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) # mavensampleoraclejdbc ---
[INFO] Installing /Users/jean/Downloads/MavenOracle/MavenSampleOracleJdbc-master/target/mavensampleoraclejdbc-1.0.0-SNAPSHOT.jar to /Users/jean/.m2/repository/com/github/sgrillon14/mavensampleoraclejdbc/1.0.0-SNAPSHOT/mavensampleoraclejdbc-1.0.0-SNAPSHOT.jar
[INFO] Installing /Users/jean/Downloads/MavenOracle/MavenSampleOracleJdbc-master/pom.xml to /Users/jean/.m2/repository/com/github/sgrillon14/mavensampleoraclejdbc/1.0.0-SNAPSHOT/mavensampleoraclejdbc-1.0.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.900 s
[INFO] Finished at: 2018-02-12T17:06:49+01:00
[INFO] Final Memory: 12M/309M
[INFO] ------------------------------------------------------------------------
wagram:MavenSampleOracleJdbc-master jean$
Here's the underlying problem
Access denied to: https://maven.oracle.com/com/oracle/jdbc/ojdbc8/12.2.0.1/ojdbc8-12.2.0.1.pom , ReasonPhrase:Forbidden
I'm guessing you have the wrong username/password in your settings.xml. Try hitting the URL in your browser and enter the username/password. Possibly your credentials have expired? Or maybe you have a different settings.xml on travis than your localhost?
If you don't have dependency add it otherwise for oracle, replace it with the following code:
<dependency>
<groupId>com.oracle.ojdbc</groupId>
<artifactId>ojdbc8</artifactId>
<version>19.3.0.0</version>
</dependency>
I tested for downloading ojdbc8.jar from 12.2.0.1. I was able to download without any issues. But, there is a warning. But, the warning is due to the missing *.md5 file in the maven repository. (We are looking into that issue)
Downloading: https://maven.oracle.com/com/oracle/jdbc/ojdbc8/12.2.0.1/ojdbc8-12.2.0.1.pom
[WARNING] Checksum validation failed, expected 3626be7f20ea523d9fd6aca576d5aba3f7afb3fe but is f1be766b419370110b86bd088a69c1bfcdca6989 for https://maven.oracle.com/com/oracle/jdbc/ojdbc8/12.2.0.1/ojdbc8-12.2.0.1.pom
Downloaded: https://maven.oracle.com/com/oracle/jdbc/ojdbc8/12.2.0.1/ojdbc8-12.2.0.1.pom (7 KB at 0.4 KB/sec)
The Oracle Maven repository requires you to agree with the terms and conditions of using it. Thus, in order to provide this agreement:
go to Oracle.com and login
go to https://maven.oracle.com
the page shown shows:
...
Directory browsing is not allowed on the Oracle Maven Repository.
Registration is required to access the Oracle Maven Repository. To register, please visit the registration site.
...
The link to the "registration site" is actually http://www.oracle.com/webapps/maven/register/license.html
where you have to accept the terms and conditions. This allows you to use the Oracle Maven repository.
For further details on setting up Maven and published drivers, pleaase refer to
https://blogs.oracle.com/dev2dev/get-oracle-jdbc-drivers-and-ucp-from-oracle-maven-repository-without-ides
version in the MANIFEST is 12.2.0.1.0 not 12.2.0.1 but still the problem
"Content Server Request Failed
Error Unable to download '(null)'. 'path:/Enterprise Libraries/content/maven/content/com/oracle/jdbc/ojdbc8/12.2.0.1/ojd‌​bc8-12.2.0.1.pom' does not exist.
"
my credential are OK and got the problem on
https://www.oracle.com/content/secure/maven/content/com/oracle/jdbc/ojdbc6/ojdbc6-11.2.0.4.0.pom
(the URL you are redirected to when accessing to maven.oracle.com)
too
FYI:
Latest attempt this Sat 6/01/2018 morning: OK, was able to download ojdbc8 POM from a browser.
This artifact was moved to:
com.oracle.database.jdbc » ojdbc10

Maven won't run tests from parent or child projects

I got a multi-module project. Each project has its own unittest same for the parent project. When I use mvn test no tests are run and the target folder does not contain any test classes. Parent project doesn't even create a target folder
Structure looks like this:
|-module1-> pom.xml
|-module2-> pom.xml
|-module3-> pom.xml
|-src/main
|-src/test/java/MyTest.java
|-pom.xml
See poms below ( I omited standard pom boilerplate)
parent pom.xml
<groupId>com.tests</groupId>
<artifactId>unit-tests</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>module1</module>
<module>module2</module>
<module>module3</module>
</modules>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
<version>RELEASE</version>
</dependency>
<dependencies>
Child pom has:
<parent>
<groupId>com.tests</groupId>
<artifactId>unit-tests</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
Whenever i run mvn clean test no tests are run and in the console i get something like:
[INFO] ------------------------------------------------------------------------
[INFO] Building unit-tests 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] ------------------------------------------------------------------------
Btw, parent project does not have any source code, just tests
You're using packaging pom. With that kind of packaging you're only allowed to run a small number of goals bound to phases (like install and deploy). In order to run the tests in the parent you must be explicit about your intentions, like this:
$mvn clean compiler:testCompile surefire:test
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.tests.unit_tests.TestModules
Test1!
[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.016 s <<< FAILURE! - in com.tests.unit_tests.TestModules
[ERROR] test1(com.tests.unit_tests.TestModules) Time elapsed: 0.003 s <<< FAILURE!
java.lang.AssertionError
at com.tests.unit_tests.TestModules.test1(TestModules.java:11)
[INFO]
[INFO] Results:
[INFO]
[ERROR] Failures:
[ERROR] TestModules.test1:11
[INFO]
[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] unit-tests ......................................... FAILURE [ 1.262 s]
[INFO] module1 ............................................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.473 s
[INFO] Finished at: 2017-12-02T11:04:50-02:00
[INFO] Final Memory: 16M/207M
[INFO] ------------------------------------------------------------------------
That way you are telling maven that you want to compile (generate your target) and run your tests in the aggregator (which has the parent pom). Otherwise maven will only run the tests in the modules.
$mvn test
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] unit-tests
[INFO] module1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building unit-tests 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building module1 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # module1 ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.2:compile (default-compile) # module1 ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # module1 ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.2:testCompile (default-testCompile) # module1 ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.17:test (default-test) # module1 ---
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] unit-tests ......................................... SUCCESS [ 0.002 s]
[INFO] module1 ............................................ SUCCESS [ 0.424 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.504 s
[INFO] Finished at: 2017-12-02T11:06:24-02:00
[INFO] Final Memory: 9M/241M
[INFO] ------------------------------------------------------------------------
I know that it is a hard reading, but you should check it out:
http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html#Packaging
For example, a project that is purely metadata (packaging value is
pom) only binds goals to the install and deploy phases (for a complete
list of goal-to-build-phase bindings of some of the packaging types,
refer to the Lifecycle Reference).
EDIT
As eis pointed out. Even though it's possible to do it, maven made it hard to do it because you SHOULDN't do it by default. Your unit tests should be in the module they are testing. It's not a good practice to scatter them.
The answer is: you can do it, yes. But you shouldn't! There are somethings in life that you can do, but shouldn't...
If we were talking about integration tests that would be a different story.. That's a different discussion.
Cheers!
The maven surefire plugin runs all JUnit Test where the name of the testclass ends with Test - with a capital 'T'. According to your info your test class is named Mytest. Refactor that class to be named MyTest will make it work.
multimodule parent has the packaging pom, and as such, can by definition only contain the pom, not any source code (not even test source code!). This is the reason your tests won't run and you don't get a target folder: there cannot be anything to run or compile on a project of type pom. A multimodule parent is only meant to group the modules together.

Coding multiple modules from multiple git repos with different release cycles in IntelliJ / Maven

I'm working on a project which has 4 modules each in its own git repo and with its own release cycle:
parent-pom
lib1
lib2
server1
There is also another project, say "server2" which also depends on lib1 and lib2 and inherits the parent pom.
I have them set up in Maven and Teamcity, with release and snapshot artifact repos, but I'm trying to work out how to configure my environment in IntelliJ so that it builds them all together locally on my workstation.
I don't want to do git pushes or mvn deploys every time I change a version in the parent pom or a parameter on the library API.
The parent pom and the libraries are shared by another project, which is why they have separate git repos and release cycles, so that the other project is not constrained by activity on this project.
I want both IntelliJ to pick up, compile and run the latest code changes I make locally, e.g. when running the REST server, and simultaneously I want maven to handle the local changes when I run mvn tasks.
I used the mvn relativePath short-cut in the modules to point to the parent-pom like so:
<relativePath>../shared-parent-pom</relativePath>
I've created an aggregator project for server1 like this in its own directory here:
/workspace/parent-pom
/workspace/lib1
/workspace/lib2
/workspace/server1
/workspace/aggregator-pom
like this:
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.me.stuff</groupId>
<artifactId>aggregator</artifactId>
<packaging>pom</packaging>
<version>1-SNAPSHOT</version>
<modules>
<module>../shared-parent-pom</module>
<module>../gem-utilities</module>
<module>../gem-security</module>
<module>../tardis</module>
</modules>
</project>
This works OK with for test and package, but when I run some plugins, e.g. the dependency plugin:
mvn dependency:tree
I see that Maven is going to the repos to try to download the lib1 snapshot that lib2 is dependent on, and failing:
C:\dev\tools\Java\jdk1.8.0_131\bin\java -Dmaven.multiModuleProjectDirectory=C:\dev\workspace\aggregator -Dmaven.home=C:\IntelliJ-2017.1\plugins\maven\lib\maven3 -Dclassworlds.conf=C:\IntelliJ-2017.1\plugins\maven\lib\maven3\bin\m2.conf -javaagent:C:\IntelliJ-2017.1\lib\idea_rt.jar=62781:C:\IntelliJ-2017.1\bin -Dfile.encoding=UTF-8 -classpath C:\IntelliJ-2017.1\plugins\maven\lib\maven3\boot\plexus-classworlds-2.5.2.jar org.codehaus.classworlds.Launcher -Didea.version=2017.1.4 -s C:\Users\adam\.m2\settings.xml dependency:tree
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] lib1
[INFO] lib2
[INFO] server
[INFO] aggregator
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building lib1 1.0.2-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) # lib1 ---
[INFO] com.me.stuff:lib1:jar:1.0.2-SNAPSHOT
[INFO] +- org.junit.jupiter:junit-jupiter-api:jar:5.0.0-M4:test
[INFO] | +- org.opentest4j:opentest4j:jar:1.0.0-M2:test
[INFO] | \- org.junit.platform:junit-platform-commons:jar:1.0.0-M4:test
[INFO] +- org.lots-of-stuff:lots-of-stuff:jar:1.0.0:test
[INFO] ------------------------------------------------------------------------
[INFO] Building lib2 1.0.2-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: http://my.artifactory.repo:8088/artifactory/snapshot-local/com/me/stuff/lib1/1.0.2-SNAPSHOT/maven-metadata.xml
Downloading: http://my.artifactory.repo:8088/artifactory/snapshot-local/com/me/stuff/lib1/1.0.2-SNAPSHOT/lib1-1.0.2-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] lib1 ............................................... SUCCESS [ 2.612 s]
[INFO] lib2 ............................................... FAILURE [ 2.378 s]
[INFO] server ............................................. SKIPPED
[INFO] aggregator ......................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.804 s
[INFO] Finished at: 2017-06-30T14:26:32+01:00
[INFO] Final Memory: 29M/275M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project lib2: Could not resolve dependencies for project com.me.stuff:lib2:jar:1.0.2-SNAPSHOT: Could not find artifact com.me.stuff:lib1:jar:1.0.2-SNAPSHOT in local-snapshots (http://my.artifactory.repo:8088/artifactory/snapshot-local) -> [Help 1]
[ERROR]
How do I tell maven not to try to download repos but to act from the locally compiled source code?
Ideally if anyone is doing this in Eclipse, I prefer a solution that works there as well as IntelliJ and on the cmd line.

Jenkins not running TestNG tests via surefire

Have a local set up using Maven and TestNG which builds just fine. The build is a little odd given that in order for the tests to run, a packaged JAR is needed first. So in effect the local setup runs
#!/bin/bash
mvn clean package -Dmaven.test.skip.exec=true
mvn test
When run on Jenkins, the clean/package step succeeds as does test, except no tests are actually run:
[workspace] $ mvn -f some_sub_directory/pom.xml test
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building ...-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) # project ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /var/lib/jenkins/jobs/...
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) # project ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) # project ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) # project ---
[INFO] Not compiling test sources
[INFO]
[INFO] --- maven-surefire-plugin:2.10:test (default-test) # project ---
[INFO] Tests are skipped.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.222s
[INFO] Finished at: Fri Nov 22 18:34:00 UTC 2013
[INFO] Final Memory: 11M/89M
[INFO] ------------------------------------------------------------------------
Finished: SUCCESS
Seems as though the testCompile and test goals in the surefire plugin aren't finding any test classes.
Is there an additional config needed in pom.xml?
The default and recommended path for test classes is {basedir}/src/test/java/.
But you can precise the path in your pom.xml
<build>
<testSourceDirectory>{basedir}/path/to/test/classes</testSourceDirectory>
...
</build>
You need to specify your tests that need to be run. I believe, it looks for tests starting with test*. If you are using a testng xml then you need to set that up. Check this link out for examples on how to specify tests in different ways.

mvn one:convert don't work?

Finally, I found that some dependency of maven-one-plugin don't install properly. but fix them this plugin work.
question fixed :
I am working on convert a maven 1 project to maven 2 project so I just run this command at the folder of the project:
mvn one:convert
then get a error:
[INFO] Internal error in the plugin manager executing goal
'org.apache.maven.plugins:maven-one-plugin:1.2:convert':
Unable to find the mojo 'org.apache.maven.plugins:maven-one-plugin:1.2:convert' in
the plugin 'org.apache.maven.plugins:maven-one-plugin'
org.apache.maven.model.v3_0_0.PatternSet
Anybody know the reason ? Sorry I just so green on maven and the task is urgent...
Try maven-one-plugin:convert
Please take a look at the plugin manual and check if your configuration matches the required configuration.
http://maven.apache.org/plugins/maven-one-plugin/usage.html
The plugin does exist in central repo
Just wondering if you are running this command using maven 1. If so, can you install maven 2/3 and try?
Edit 1:
Downloaded a sample Maven 1 project from here.
Ran mvn convert:one using the latest maven (maven 3).
Worked successfully
D:\work\sample-echo>mvn one:convert
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-one-plugin:1.2:convert (default-cli) # standalone-pom ---
[INFO] Adding report org.apache.maven.plugins:maven-changes-plugin
[INFO] There are 14 plugin relocators available
[INFO] Writing new pom to: D:\work\sample-echo\pom.xml
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.950s
[INFO] Finished at: Wed Jun 22 15:01:52 IST 2011
[INFO] Final Memory: 4M/15M
[INFO] ------------------------------------------------------------------------

Categories