Friday, July 18, 2014

Solving Eclipse and Maven problems:

"Failed to read artifact descriptor for"


I've spent most of today trying to add a dependency for the Cassandra Java driver to a maven pom in eclipse with little luck at all.  Worst when I tried it on another machine it worked fine so it was something wrong with my mac laptop.  Nothign I did would work, I kept on getting a error " Failed to read artifact descriptor for com.datastax.cassandra" etc. Looking at:

Stackoverflow: Maven: Failed to read artifact descriptor 

It suggested Maven -> Update Project and click on the force option.  No joy there !  It was only when I tried a manual mvn -U clean install command that I got the full error:
 "Failed to execute goal on project testmaven: Could not resolve dependencies for project uk.ac.dundee.computing.aec:testmaven:jar:0.0.1-SNAPSHOT: Failed to collect dependencies at com.datastax.cassandra:cassandra-driver-core:jar:2.0.3: Failed to read artifact descriptor for com.datastax.cassandra:cassandra-driver-core:jar:2.0.3: Could not transfer artifact com.datastax.cassandra:cassandra-driver-core:pom:2.0.3 from/to central (http://repo.maven.apache.org/maven2): Specified destination directory cannot be created: /Users/Administrator/.m2/repository/com/datastax/cassandra/cassandra-driver-core/2.0.3"
Looking at the permissions on /Users/Administrator/.m2/repository/com/datastax/cassandra/ did I see that the sub directories where owned by root. I must have used sudo at some point to manually build the cassandra java driver from a git repo (in fact I knew I did).

The answer then was to delete  /Administrator/.m2/repository/com/datastax and then run the force maven project update in eclipse.

All now works well !

Update to Java 1.8

I also ran into a problem changing the java version of a project from 1.5 to 1.7 or 1.8.  Yes you can change the project facet, but you'll find that a maven update will change it back to 1.5.  This stakoverflow has the correct answer:

Java. Warning - Build path specifies execution environment J2SE-1.4

Open the pom.xml file and add the following to the section
      <pluginManagement>  
           <plugins>  
                <plugin>  
                     <groupId>org.apache.maven.plugins</groupId>  
                     <artifactId>maven-compiler-plugin</artifactId>  
                     <configuration>  
                          <source>1.8</source>  
                          <target>1.8</target>  
                     </configuration>  
                </plugin>  
           </plugins>  
      </pluginManagement>  


You will need to do a maven update from eclipse after that.

Change Web app facet to 3.0

If you create a dynamic webapp from the file->new->maven project and select maven-archetype-webapp you may find that it is "stuck" at version 2.3.  If you try and change it to 2.4 or higher (3.1 for instance) you'll be prevented. Deep inside this thread is on stackoverflow is the correct answer (for me):

Cannot change version of project facet Dynamic Web Module to 3.0?


In eclipse, go to window->show vie -> navigator.  Now in the navigator window you should see the .settings folder.  Open the folder and open the file org.eclipse.wst.common.project.facet.core.xml  Inside that file you should see jst.web and you can change the webapp facet version there.  Again do a maven update from eclipse after that.

32 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. The truth is i really appreciate your article ^^ thanks for this really helps a lot my web development company in the Philippines

    ReplyDelete
  3. Your post has everything that is obtained complete and really useful. It's a beautiful presentation. It's really help to choose a web design company. This post is very good. Thank you for presenting a very good post.

    Web Design London | London Web Design Company

    ReplyDelete
  4. Virginia Web Design is one of the most professional and experienced web designing companies in the world.

    ReplyDelete
  5. Any way I'll be subscribing to your feed and I hope you post again soon.
    Signature:
    juegos juegos | juegos de matar zombies | jogos

    ReplyDelete
  6. You topic is very great and useful for us…thank you
    Signature:
    i like play games friv than play games games2girls and play game kids games online ! have fun!

    ReplyDelete
  7. This kind of errors in the source code are quite usual and we neglect the version update problems generally which might be the only solution. Thanks for alerting with the example, we are a Colorado Web Development company providing web design and development services at affordable prices.

    ReplyDelete
  8. Very Informative! This blog is great source of information which is very useful for me. Thank you very much for

    sharing this!
    web development company in delhi

    ReplyDelete
  9. I had visited your website which was really good I continuously read your post now I am Waiting for Next one.. Web Development & Website Design Company USA

    ReplyDelete
  10. Thank you for your post, I look for such article along time, today i find it finally. this post give me lots of advise it is very useful for me
    Signature:
    facebook entrar iniciar sesion gratis - Sitio Oficial iniciado sesión en Facebook lengua española. facebook entrar rápido, facebook iniciar sesion en tu cuenta de entrar facebook

    ReplyDelete
  11. Thanks for sharing the information. It is very useful for my future. keep sharing
    Signature:
    Versión en facebook en español descargar a los países hablan Español: facebook entrar direto agora , facebook en español para and facebook entrar direto

    ReplyDelete
  12. This is extremely helpful info!! Very good work. Everything is very interesting to learn and easy to understood. Thank you for giving information.
    Signature:
    The place to play all unblocked games online. Here you can find every blocked games such as: unblockedgames , unblocked games happy , unblocked games 77 , gmod

    ReplyDelete
  13. I would like to thank you for your nicely written post
    Signature:
    download baixar facebook movel, Facebook movel, baixar facebook movel. Facebook chat, baixar whatsapp gratis, fazer o download baixar whatsapp para Android, iPhone. Últimas Facebook

    ReplyDelete
  14. Thanks for sharing the information related to web development services. If you are a good web development service provider than your business will grow definitely and you can beat the competitors easily.

    ReplyDelete
  15. I was working and suddenly I visits your site frequently and recommended it to me to read also. The writing style is superior and the content is relevant. Thanks for the insight you provide the readers!
    kids games online , friv 2 , jogos do friv , juegosjuegos.com , juegos de matar zombbies
    , juegos de un show mas

    ReplyDelete
  16. Great information....i have a getting the lot of information on this post...thank you for sharing the useful information...Website Designing Company Bangalore | Website Development Companies Bangalore

    ReplyDelete
  17. I am impressed by the quality of information on this website. There are a lot of good resources here. I am sure I will visit this blog again soon.
    happy wheels
    super mario bros
    pacman
    agario

    ReplyDelete
  18. Thanks for sharing the information. It is very useful for my future. keep sharing
    Kizi 123|
    Friv 234|
    Friv

    ReplyDelete
  19. Great info!! thanks for the share.Website designing and development is important factors to develop online business and possible to create awareness about services and products as it is an online portal.
    Web Designers in Bangalore|Logo Design in Bangalore

    ReplyDelete
  20. Hi. Today, I read!!!
    Your post has everything that is obtained complete and really useful.
    Thanks u for sharing.
    Run 3
    Head Soccer
    Juegos De Terror
    Mahjong Free Games
    Cool math 4 kids

    ReplyDelete
  21. I like the flash and free games. Here is one of my favorite games today.
    Friv 10

    ReplyDelete
  22. Hello to every body, it's my first pay a quick visit of this weblog; this weblog carries amazing and really excellent data in favor of readers.
    Friv 4
    Kizi 3

    ReplyDelete
  23. Thanks for sharing your info. I really appreciate your efforts and I will be waiting for your further write.
    Friv 10

    ReplyDelete
  24. Browse more than 600 job categories including programming, eBay, Amazon, photoshop, web development, design, writing, data entry and more on Freelancer. Join to http://www.freelancer.com and change your life forever!

    ReplyDelete
  25. You need to kill time, you need entertainment. Refer to our website. hope you get the most comfort.
    Thanks you for sharing!
    Yepi
    Kizi
    Friv
    Friv Games

    ReplyDelete