Maven build error - Could not resolve dependencies for project [duplicate]

1

This message appears in my Maven application

ItriedtobuildaMavenbuildwiththecleanpackagecommand

[INFO]Scanningforprojects...[INFO][INFO]Usingthebuilderorg.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilderwithathreadcountof1[INFO][INFO]------------------------------------------------------------------------[INFO]BuildingPedidoVenda1.0.0-SNAPSHOT[INFO]------------------------------------------------------------------------[INFO]Downloading:http://repository.primefaces.org/com/outjected/simple-email/0.1.2-SNAPSHOT/maven-metadata.xml[INFO]Downloading:http://repository.primefaces.org/com/outjected/simple-email/0.1.2-SNAPSHOT/simple-email-0.1.2-SNAPSHOT.pom[WARNING]ThePOMforcom.outjected:simple-email:jar:0.1.2-SNAPSHOTismissing,nodependencyinformationavailable[INFO]Downloading:http://repository.primefaces.org/com/outjected/simple-email/0.1.2-SNAPSHOT/simple-email-0.1.2-SNAPSHOT.jar[INFO]------------------------------------------------------------------------[INFO]BUILDFAILURE[INFO]------------------------------------------------------------------------[INFO]Totaltime:6.442s[INFO]Finishedat:2015-06-27T18:34:09-03:00[INFO]FinalMemory:7M/94M[INFO]------------------------------------------------------------------------[ERROR]FailedtoexecutegoalonprojectPedidoVenda:Couldnotresolvedependenciesforprojectcom.algaworks:PedidoVenda:war:1.0.0-SNAPSHOT:Couldnotfindartifactcom.outjected:simple-email:jar:0.1.2-SNAPSHOTinprime-repo(http://repository.primefaces.org)->[Help1][ERROR][ERROR]Toseethefullstacktraceoftheerrors,re-runMavenwiththe-eswitch.[ERROR]Re-runMavenusingthe-Xswitchtoenablefulldebuglogging.[ERROR][ERROR]Formoreinformationabouttheerrorsandpossiblesolutions,pleasereadthefollowingarticles:[ERROR][Help1]http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

What'sgoingon?

Andhowtosolvetheproblem?

Pom.xml

<projectxmlns="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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.algaworks</groupId>
    <artifactId>PedidoVenda</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>war</packaging>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencies>
        <!-- Implementacao do Bean Validation -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>5.0.1.Final</version>
            <scope>compile</scope>
        </dependency>

        <!-- Núcleo do Hibernate -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>4.2.3.Final</version>
            <scope>compile</scope>
        </dependency>

        <!-- Implementação de EntityManager da JPA -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>4.2.3.Final</version>
            <scope>compile</scope>
        </dependency>

        <!-- Driver JDBC do MySQL -->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.25</version>
            <scope>compile</scope>
        </dependency>

        <!-- Weld (implementação do CDI) -->
        <dependency>
            <groupId>org.jboss.weld.servlet</groupId>
            <artifactId>weld-servlet</artifactId>
            <version>1.1.10.Final</version>
            <scope>compile</scope>
        </dependency>

        <!-- PrimeFaces (biblioteca de componentes) -->
        <dependency>
            <groupId>org.primefaces</groupId>
            <artifactId>primefaces</artifactId>
            <version>3.5</version>
            <scope>compile</scope>
        </dependency>

        <!-- Mojarra (implementacao do JSF) -->
        <dependency>
            <groupId>org.glassfish</groupId>
            <artifactId>javax.faces</artifactId>
            <version>2.1.21</version>
            <scope>compile</scope>
        </dependency>

        <!-- OmniFaces (utilitarios para JSF) -->
        <dependency>
            <groupId>org.omnifaces</groupId>
            <artifactId>omnifaces</artifactId>
            <version>1.5</version>
            <scope>compile</scope>
        </dependency>

        <!-- Log4J -->      
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
            <scope>compile</scope>
        </dependency>

        <!-- Commons Logging (abstrai a implementação de logging) -->
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.1.3</version>
            <scope>compile</scope>
        </dependency>

        <!-- Commons Lang (utilidades) -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.1</version>
            <scope>compile</scope>
        </dependency>

        <!-- Abstração para envio de e-mails -->        
        <dependency>
            <groupId>com.outjected</groupId>
            <artifactId>simple-email</artifactId>
            <version>0.1.2-SNAPSHOT</version>
            <scope>compile</scope>
        </dependency>

        <!-- Requerido para envio de e-mails -->
        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
            <version>1.4.7</version>
            <scope>compile</scope>
        </dependency>

        <!-- Usamos para templates de emails -->
        <dependency>
            <groupId>org.apache.velocity</groupId>
            <artifactId>velocity</artifactId>
            <version>1.7</version>
            <scope>compile</scope>
        </dependency>

        <!-- Usamos para formatar números em templates -->
        <dependency>
            <groupId>velocity-tools</groupId>
            <artifactId>velocity-tools-generic</artifactId>
            <version>1.1</version>
            <scope>compile</scope>
        </dependency>

        <!-- Spring Security (autenticação e autorização) -->
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
            <version>3.1.4.RELEASE</version>
        </dependency> 
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <version>3.1.4.RELEASE</version>
        </dependency> 
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>3.1.4.RELEASE</version>
        </dependency>

        <!-- API de Servlet -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.0.1</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <finalName>PedidoVenda</finalName>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.0</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <repositories>
        <repository>
            <id>prime-repo</id>
            <name>PrimeFaces Maven Repository</name>
            <url>http://repository.primefaces.org</url>
            <layout>default</layout>
        </repository>
    </repositories>

</project>
    
asked by anonymous 27.06.2015 / 23:39

2 answers

1

Just below the comment

<!-- Abstração para envio de e-mails -->

The following jar is being defined as dependency: simple-email:jar

In your pom.xml you also define a repository, where Maven looks at dependencies:

<repositories>
        <repository>
            <id>prime-repo</id>
            <name>PrimeFaces Maven Repository</name>
            <url>http://repository.primefaces.org</url>
            <layout>default</layout>
        </repository>
    </repositories>

Maven is not finding this dependency in this repository. In which it is there I can no longer help you, it is possible that this is a problem accessing this repository. But when I went through similar problems, I took the following approach

First, run:

mvn dependency:resolve

In sequence, make the following checks:

  • Check if the repository you are accessing requests. maven can not provide the correct credentials. They are placed in your $ {user.home} / .m2 / settings.xml file

  • The repository you are trying to access uses SSL, and the JVM running Maven does not trust these certificates.

  • There are problems in your network, for example, there is a missing proxy to access this repository

  • Maven is not able to save the files in your local registry, for example, Maven is not allowed to save.

Last, but not least, check if this jar exists in this repository, if it does not exist, you will need to tell Maven which recipe to fetch this jar.

Source: link

    
28.06.2015 / 00:13
1

The artifact in question is not available in the repository. (which it is trying to find), I also checked maven's central repository and I could not find it.

You should include a new repository in your application (pom.xml) or maven (settings.xml) global settings. example:

  

pom.xml

<repositories>
    <repository>
        <id>novo-repo</id>
        <url>http://urlnovorepo.com/repo</url>
    </repository>
</repositories>


  

settings.xml

  <profile>
     <id>meuprofile</id>
     <repositories>
       <repository>
         <id>novo-repo</id>
         <name>novo repositorio global</name>
         <url>http://urlnovorepo.com/repo</url>
       </repository>
     </repositories>
   </profile>

You can note that in the global configuration the repository was created in a new profile, you can configure it as the default or activate the profile directly on the command line when executing your maven routine.

  

via command line maven

mvn -Pmeuprofile ...


  

via configuration block setting default profile in settings.xml

 <activeProfiles>
   <activeProfile>meuprofile</activeProfile>
 </activeProfiles>


If you do not have or know the repository one possibility is to add the dependency manually in your local repository with the command line (in the same folder where the jar is in question):

mvn install:install-file -Dfile=simple-email-0.1.2-SNAPSHOT.jar \
     -DgroupId=com.outjected -DartifactId=simple-email \
     -Dversion=0.1.2-SNAPSHOT -Dpackaging=jar

From what I saw this library is a fork of another project and you can probably find it at: link

    
28.06.2015 / 00:14