Chapter 06 running sample

  3 posts   Feedicon  
Replies: 2 - Last Post: July 18, 2011 21:52
by: Warllock_GDL
showing 1 - 3 of 3
 
Posted: July 13, 2011 23:10 by Warllock_GDL
Hi,

I've spend a couple of hours trying to run the sample exercise that comes in the book, but I haven't had any luck could you help, here is what I get from maven when creating the package.

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Chapter 06 - EJB
[INFO] task-segment: [package]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
Downloading: http://repo1.maven.org/maven2/org/glassfish/javax.ejb/3.0/javax.ejb-3.0.pom
[INFO] Unable to find resource 'org.glassfish:javax.ejbTongueom:3.0' in repository central (http://repo1.maven.org/maven2)
Downloading: http://repo1.maven.org/maven2/org/glassfish/ejb/ejb-container/3.0/ejb-container-3.0.pom
[INFO] Unable to find resource 'org.glassfish.ejb:ejb-containerTongueom:3.0' in repository central (http://repo1.maven.org/maven2)
Downloading: http://repo1.maven.org/maven2/org/glassfish/javax.ejb/3.0/javax.ejb-3.0.jar
[INFO] Unable to find resource 'org.glassfish:javax.ejb:jar:3.0' in repository central (http://repo1.maven.org/maven2)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.

Missing:
----------
1) org.glassfish:javax.ejb:jar:3.0

Try downloading the file manually from the project website.

Then, install it using the command:
mvn install:install-file -DgroupId=org.glassfish -DartifactId=javax.ejb -Dversion=3.0 -Dpackaging=jar -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=org.glassfish -DartifactId=javax.ejb -Dversion=3.0 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

Path to dependency:
1) com.apress.javaee6:chapter06:jar:1.0
2) org.glassfish:javax.ejb:jar:3.0

----------
1 required artifact is missing.

for artifact:
com.apress.javaee6:chapter06:jar:1.0

from the specified remote repositories:
central (http://repo1.maven.org/maven2)



[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Wed Jul 13 18:09:11 CDT 2011
[INFO] Final Memory: 6M/12M
[INFO] ------------------------------------------------------------------------


and POM is

<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.apress.javaee6</groupId>
<artifactId>chapter06</artifactId>
<packaging>jar</packaging>
<version>1.0</version>
<name>Chapter 06 - EJB</name>


<!-- <parent>
<groupId>com.apress.javaee6</groupId>
<artifactId>chapters</artifactId>
<version>1.0</version>
</parent> -->

<dependencies>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
<version>2.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.ejb</artifactId>
<version>3.0</version>
</dependency>

<dependency>
<groupId>org.glassfish.ejb</groupId>
<artifactId>ejb-container</artifactId>
<version>3.0</version>
<scope>test</scope>
</dependency>
<!--<dependency>-->
<!--<groupId>org.glassfish.embedded</groupId>-->
<!--<artifactId>glassfish-embedded-all</artifactId>-->
<!--<version>${glassfish-version}</version>-->
<!--<scope>test</scope>-->
<!--</dependency>-->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
<configuration>
<archive>
<manifest>
<mainClass>com.apress.javaee6.chapter06.Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>

</project>



 
Posted: July 14, 2011 12:50 by Alexis Moussine-Pouchkine
You need to reference the parent POM (currently commented out) which defines additional Maven repositories.
Adding the following to this POM should also work :
        <repository>
            <id>maven2-repository.dev.java.net</id>
            <name>Java.net Repository for Maven 2</name>
            <url>http://download.java.net/maven/2</url>
        </repository>
 
Posted: July 18, 2011 21:52 by Warllock_GDL
Thanks Alexis I think I did run it in that way but it send me this error


[INFO] Scanning for projects...
Downloading: http://repo1.maven.org/maven2/com/apress/javaee6/chapters/1.0/chapt
ers-1.0.pom
[INFO] Unable to find resource 'com.apress.javaee6:chaptersTongueom:1.0' in reposito
ry central (http://repo1.maven.org/maven2)
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).


In the chapter 2 I preferred to remove the parent and it worked fine, that's why I commented out that section, but anyway I still can not compile any other ideas guys Smile
Replies: 2 - Last Post: July 18, 2011 21:52
by: Warllock_GDL
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120127.ac94057)
 
 
Close
loading
Please Confirm
Close