Guest User

Untitled

a guest
Feb 18th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. Prerequisite: 1. Make sure you have set your user name and password in the settings.xml (check in Resource folder included in package)in (C:\Users\Dinesh\.m2). (if <localRepository> tag is present, then it is the path of local repo. )
  2. Prerequisite: 2. Take only the projects pom.xml file.
  3. 1. Create a folder and put the POM.xml file in it.
  4. 2. Open command prompt and cd(change directory) to that folder which contains POM.xml file.
  5. 3. First to get the binaries use below command.
  6. mvn dependency:copy-dependencies -DoutputDirectory=\your directory\
  7. 3.1. Build may get Failure due to some dependencies may not be available in the public repository.
  8. 3.2. Hence for dealing such case, Note down the missing dependencies from the command prompt and we have to get the source manually from the desired source.
  9. 3.3. Alter the POM file to point it to all that downloaded dependency files.
  10. We must include 2 additional tag under that each missing dependency.
  11. <scope>system</scope>
  12. <systemPath>Path to that missing jar file (ex: project-1.0.0.jar)</systemPath>
  13.  
  14. So download manually into the system and alter the POM with scope and systempath tags to point it to the file. So the Pom file now becomes.
  15. 3.4. Now re-run the above command now the Build should get successful.
  16. 4. To get the Source add “–Dclassifier=sources” along with the above command.
  17. 5. Bonus: Even we can able to find the dependencies and transitive dependencies easily in a tree structure. i.e We can able to see which jar came from which library using below command.
  18. mvn dependency:tree (removes repeated jars)or
  19. mvn dependency:tree –Dverbose (shows repeated jars)
Add Comment
Please, Sign In to add comment