Maven package komutu hata veriyor
Closed this issue · 3 comments
msimav commented
Challenge degerlendirme surecinde codunu maven ile calismasini bekliyoruz. Bunun icin
mvn clean test package
komutu kullaniyoruz fakat bu komut asagidaki hatayi veriyor. Bunu duzeltip maven'i calisir hale getirebilir misin?
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building VNGRS_Contacts_Challenge 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The artifact dbunit:dbunit:jar:2.2 has been relocated to org.dbunit:dbunit:jar:2.2
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ VNGRS_Contacts_Challenge ---
[INFO] Deleting /vagrant/vngrs/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ VNGRS_Contacts_Challenge ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ VNGRS_Contacts_Challenge ---
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 16 source files to /vagrant/vngrs/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] bootstrap class path not set in conjunction with -source 1.6
/vagrant/vngrs/src/main/java/com/seyma/springmvc/controller/AppController.java:[8,18] error: package javax.ws.rs does not exist
[ERROR] /vagrant/vngrs/src/main/java/com/seyma/springmvc/controller/AppController.java:[9,23] error: package javax.ws.rs.core does not exist
[ERROR] /vagrant/vngrs/src/main/java/com/seyma/springmvc/controller/AppController.java:[23,22] error: package com.google.gson does not exist
[ERROR] /vagrant/vngrs/src/main/java/com/seyma/springmvc/controller/AppController.java:[76,5] error: cannot find symbol
[ERROR] symbol: class Consumes
location: class AppController
/vagrant/vngrs/src/main/java/com/seyma/springmvc/controller/AppController.java:[64,8] error: cannot find symbol
[ERROR] symbol: class Gson
location: class AppController
/vagrant/vngrs/src/main/java/com/seyma/springmvc/controller/AppController.java:[64,24] error: cannot find symbol
[INFO] 6 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.495 s
[INFO] Finished at: 2016-11-29T12:29:36+00:00
[INFO] Final Memory: 15M/37M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project VNGRS_Contacts_Challenge: Compilation failure: Compilation failure:
[ERROR] bootstrap class path not set in conjunction with -source 1.6
[ERROR] /vagrant/vngrs/src/main/java/com/seyma/springmvc/controller/AppController.java:[8,18] error: package javax.ws.rs does not exist
[ERROR] /vagrant/vngrs/src/main/java/com/seyma/springmvc/controller/AppController.java:[9,23] error: package javax.ws.rs.core does not exist
[ERROR] /vagrant/vngrs/src/main/java/com/seyma/springmvc/controller/AppController.java:[23,22] error: package com.google.gson does not exist
[ERROR] /vagrant/vngrs/src/main/java/com/seyma/springmvc/controller/AppController.java:[76,5] error: cannot find symbol
[ERROR] symbol: class Consumes
[ERROR] location: class AppController
[ERROR] /vagrant/vngrs/src/main/java/com/seyma/springmvc/controller/AppController.java:[64,8] error: cannot find symbol
[ERROR] symbol: class Gson
[ERROR] location: class AppController
[ERROR] /vagrant/vngrs/src/main/java/com/seyma/springmvc/controller/AppController.java:[64,24] error: cannot find symbol
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
seymamutlu commented
Ben pom.xml'de ufak bir değişiklik yaptım düzelmiş olması gerekiyor. Tekrar deneyebilir misiniz? @msimav
msimav commented
Denedim, o hata cozulmus fakat su anda testlerle ilgili baska sorunlar var.
Oncelikle tekrar
mvn clean test package
calistirdigimda su hatayi aliyorum
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building VNGRS_Contacts_Challenge 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The artifact dbunit:dbunit:jar:2.2 has been relocated to org.dbunit:dbunit:jar:2.2
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ VNGRS_Contacts_Challenge ---
[INFO] Deleting /vagrant/vngrs/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ VNGRS_Contacts_Challenge ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ VNGRS_Contacts_Challenge ---
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 16 source files to /vagrant/vngrs/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ VNGRS_Contacts_Challenge ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ VNGRS_Contacts_Challenge ---
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 7 source files to /vagrant/vngrs/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ VNGRS_Contacts_Challenge ---
[INFO] Surefire report directory: /vagrant/vngrs/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running TestSuite
Configuring TestNG with: org.apache.maven.surefire.testng.conf.TestNG652Configurator@67f89fa3
INFO : org.springframework.context.support.GenericApplicationContext - Refreshing org.springframework.context.support.GenericApplicationContext@2e6a8155: startup date [Tue Nov 29 13:35:10 UTC 2016]; root of context hierarchy
INFO : org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor - JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
Tests run: 32, Failures: 2, Errors: 0, Skipped: 21, Time elapsed: 9.951 sec <<< FAILURE!
listContacts(com.seyma.springmvc.controller.AppControllerTest) Time elapsed: 0.025 sec <<< FAILURE!
org.mockito.exceptions.misusing.UnfinishedStubbingException:
Unfinished stubbing detected here:
-> at com.seyma.springmvc.controller.AppControllerTest.listContacts(AppControllerTest.java:67)
E.g. thenReturn() may be missing.
Examples of correct stubbing:
when(mock.isOk()).thenReturn(true);
when(mock.isOk()).thenThrow(exception);
doThrow(exception).when(mock).someVoidMethod();
Hints:
1. missing thenReturn()
2. you are trying to stub a final method, you naughty developer!
3: you are stubbing the behaviour of another mock inside before 'thenReturn' instruction if completed
at com.seyma.springmvc.controller.AppControllerTest.listContacts(AppControllerTest.java:67)
setUp(com.seyma.springmvc.dao.ContactDaoImplTest) Time elapsed: 6.285 sec <<< FAILURE!
org.dbunit.dataset.NoSuchTableException: contact
at org.dbunit.database.DatabaseDataSet.getTableMetaData(DatabaseDataSet.java:192)
at org.dbunit.operation.DeleteAllOperation.execute(DeleteAllOperation.java:98)
at org.dbunit.operation.CompositeOperation.execute(CompositeOperation.java:67)
at com.seyma.springmvc.dao.AbstractDaoImplTest.setUp(AbstractDaoImplTest.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:517)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:601)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:845)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1153)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
at org.testng.TestRunner.privateRun(TestRunner.java:771)
at org.testng.TestRunner.run(TestRunner.java:621)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:357)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:352)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:310)
at org.testng.SuiteRunner.run(SuiteRunner.java:259)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1199)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1124)
at org.testng.TestNG.run(TestNG.java:1032)
at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:77)
at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeMulti(TestNGDirectoryTestSuite.java:159)
at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:99)
at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:106)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
INFO : org.springframework.context.support.GenericApplicationContext - Closing org.springframework.context.support.GenericApplicationContext@2e6a8155: startup date [Tue Nov 29 13:35:10 UTC 2016]; root of context hierarchy
Results :
Failed tests: listContacts(com.seyma.springmvc.controller.AppControllerTest): (..)
setUp(com.seyma.springmvc.dao.ContactDaoImplTest): contact
Tests run: 32, Failures: 2, Errors: 0, Skipped: 21
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 19.957 s
[INFO] Finished at: 2016-11-29T13:35:17+00:00
[INFO] Final Memory: 20M/48M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project VNGRS_Contacts_Challenge: There are test failures.
[ERROR]
[ERROR] Please refer to /vagrant/vngrs/target/surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Bu hatayi cozmek icin basitce Contact.xml
ve Phone.xml
dosyalarini editliyorum
diff --git a/src/test/resources/Contact.xml b/src/test/resources/Contact.xml
index a41d555..0814ed3 100644
--- a/src/test/resources/Contact.xml
+++ b/src/test/resources/Contact.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<dataset>
- <contact id="5" NAME="SAMY" LASTNAME="MONTANA" />
- <contact id="6" NAME="TOMY" LASTNAME="FONTANA" />
+ <contactnames id="5" NAME="SAMY" LASTNAME="MONTANA" />^M
+ <contactnames id="6" NAME="TOMY" LASTNAME="FONTANA" />^M
</dataset>
\ No newline at end of file
diff --git a/src/test/resources/Phone.xml b/src/test/resources/Phone.xml
index 81584ba..c242836 100644
--- a/src/test/resources/Phone.xml
+++ b/src/test/resources/Phone.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<dataset>
- <phone contactId="5" phoneNumber="+90 522 3223223" />
- <phone contactId="6" phoneNumber="+90 543 3223332" />
+ <phonenumbers contactId="5" phoneNumber="+90 522 3223223" />^M
+ <phonenumbers contactId="6" phoneNumber="+90 543 3223332" />^M
</dataset>
Bu degisikliklerden sonra testler calisiyor fakat fail oluyor. Degisikliklerden sonra aldigim hata
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building VNGRS_Contacts_Challenge 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The artifact dbunit:dbunit:jar:2.2 has been relocated to org.dbunit:dbunit:jar:2.2
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ VNGRS_Contacts_Challenge ---
[INFO] Deleting /vagrant/vngrs/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ VNGRS_Contacts_Challenge ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ VNGRS_Contacts_Challenge ---
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 16 source files to /vagrant/vngrs/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ VNGRS_Contacts_Challenge ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ VNGRS_Contacts_Challenge ---
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 7 source files to /vagrant/vngrs/target/test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ VNGRS_Contacts_Challenge ---
[INFO] Surefire report directory: /vagrant/vngrs/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running TestSuite
Configuring TestNG with: org.apache.maven.surefire.testng.conf.TestNG652Configurator@67f89fa3
INFO : org.springframework.context.support.GenericApplicationContext - Refreshing org.springframework.context.support.GenericApplicationContext@2e6a8155: startup date [Tue Nov 29 13:41:16 UTC 2016]; root of context hierarchy
INFO : org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor - JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
Tests run: 17, Failures: 6, Errors: 0, Skipped: 0, Time elapsed: 10.129 sec <<< FAILURE!
listContacts(com.seyma.springmvc.controller.AppControllerTest) Time elapsed: 0.021 sec <<< FAILURE!
org.mockito.exceptions.misusing.UnfinishedStubbingException:
Unfinished stubbing detected here:
-> at com.seyma.springmvc.controller.AppControllerTest.listContacts(AppControllerTest.java:67)
E.g. thenReturn() may be missing.
Examples of correct stubbing:
when(mock.isOk()).thenReturn(true);
when(mock.isOk()).thenThrow(exception);
doThrow(exception).when(mock).someVoidMethod();
Hints:
1. missing thenReturn()
2. you are trying to stub a final method, you naughty developer!
3: you are stubbing the behaviour of another mock inside before 'thenReturn' instruction if completed
at com.seyma.springmvc.controller.AppControllerTest.listContacts(AppControllerTest.java:67)
findById(com.seyma.springmvc.dao.ContactDaoImplTest) Time elapsed: 0.16 sec <<< FAILURE!
java.lang.AssertionError: expected object to not be null
at org.testng.Assert.fail(Assert.java:94)
at org.testng.Assert.assertNotNull(Assert.java:406)
at org.testng.Assert.assertNotNull(Assert.java:391)
at com.seyma.springmvc.dao.ContactDaoImplTest.findById(ContactDaoImplTest.java:26)
findByName(com.seyma.springmvc.dao.ContactDaoImplTest) Time elapsed: 0.053 sec <<< FAILURE!
java.lang.AssertionError: expected [1] but found [0]
at org.testng.Assert.fail(Assert.java:94)
at org.testng.Assert.failNotEquals(Assert.java:496)
at org.testng.Assert.assertEquals(Assert.java:125)
at org.testng.Assert.assertEquals(Assert.java:372)
at org.testng.Assert.assertEquals(Assert.java:382)
at com.seyma.springmvc.dao.ContactDaoImplTest.findByName(ContactDaoImplTest.java:41)
findByNameAndLastName(com.seyma.springmvc.dao.ContactDaoImplTest) Time elapsed: 0.015 sec <<< FAILURE!
java.lang.NullPointerException
at com.seyma.springmvc.dao.ContactDaoImplTest.findByNameAndLastName(ContactDaoImplTest.java:46)
findByContactId(com.seyma.springmvc.dao.PhoneDaoImplTest) Time elapsed: 0.051 sec <<< FAILURE!
java.lang.AssertionError: expected [1] but found [0]
at org.testng.Assert.fail(Assert.java:94)
at org.testng.Assert.failNotEquals(Assert.java:496)
at org.testng.Assert.assertEquals(Assert.java:125)
at org.testng.Assert.assertEquals(Assert.java:372)
at org.testng.Assert.assertEquals(Assert.java:382)
at com.seyma.springmvc.dao.PhoneDaoImplTest.findByContactId(PhoneDaoImplTest.java:35)
findByContactIdAndPhoneNumber(com.seyma.springmvc.dao.PhoneDaoImplTest) Time elapsed: 0.005 sec <<< FAILURE!
java.lang.NullPointerException
at com.seyma.springmvc.dao.PhoneDaoImplTest.findByContactIdAndPhoneNumber(PhoneDaoImplTest.java:40)
INFO : org.springframework.context.support.GenericApplicationContext - Closing org.springframework.context.support.GenericApplicationContext@2e6a8155: startup date [Tue Nov 29 13:41:16 UTC 2016]; root of context hierarchy
Results :
Failed tests: listContacts(com.seyma.springmvc.controller.AppControllerTest): (..)
findById(com.seyma.springmvc.dao.ContactDaoImplTest): expected object to not be null
findByName(com.seyma.springmvc.dao.ContactDaoImplTest): expected [1] but found [0]
findByNameAndLastName(com.seyma.springmvc.dao.ContactDaoImplTest)
findByContactId(com.seyma.springmvc.dao.PhoneDaoImplTest): expected [1] but found [0]
findByContactIdAndPhoneNumber(com.seyma.springmvc.dao.PhoneDaoImplTest)
Tests run: 17, Failures: 6, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 20.802 s
[INFO] Finished at: 2016-11-29T13:41:24+00:00
[INFO] Final Memory: 20M/49M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project VNGRS_Contacts_Challenge: There are test failures.
[ERROR]
[ERROR] Please refer to /vagrant/vngrs/target/surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
seymamutlu commented
Gerekli değişiklikleri yaptım tekrar test edebilirsen sevinirim. @msimav