You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Nathan Sowatskey (nsowatsk)" <ns...@cisco.com> on 2005/06/09 11:30:40 UTC
M2 EJB basics
Hi
It may be that I too much of a newbie to Maven to be considering M2, but I
am trying anyway :-)
In the example below I have some EJB code that won't compile as it can't
find the EJB jars.
What I can't see is how to set the location of the EJB jars though. If this
were Maven 1.x I would use properties as part of the solution, but for M2 I
just don't know where to start.
I half suspect that I need to create a dependency, but to what and where and
how I don't know.
If someone wants to tell me that M2 is not ready for newbies, that's fine
and I will go look at 1.x. If someone can help me get this to work though,
then I will persevere and maybe help make M2 a better thing.
Thanks
Nathan
G:\nm_poc\ejb\jar>m2 install
[INFO] inventory-service-pom: using locally installed snapshot
[INFO]
-------------------------------------------------------------------------
---
[INFO] Building Inventory Service
[INFO]
-------------------------------------------------------------------------
---
[INFO] maven-jar-plugin: resolved to version 2.0-alpha-2 from local
repository
[INFO] maven-resources-plugin: resolved to version 2.0-alpha-2 from local
reposi
tory
[INFO] maven-compiler-plugin: resolved to version 2.0-alpha-2 from local
reposit
ory
[INFO] maven-surefire-plugin: resolved to version 2.0-alpha-2 from local
reposit
ory
[INFO] maven-install-plugin: resolved to version 2.0-alpha-2 from local
reposito
ry
[INFO] [resources:resources]
[INFO] [compiler:compile]
Compiling 17 source files to G:\nm_poc\ejb\jar\target\classes
[INFO]
-------------------------------------------------------------------------
---
[INFO] BUILD FAILURE
[INFO]
-------------------------------------------------------------------------
---
[INFO] Reason: Compilation failure
[INFO]
-------------------------------------------------------------------------
---
[INFO]
G:\nm_poc\ejb\jar\src\main\java\com\cisco\nm\poc\inventory\ejb\InventoryS
ession.java:[12,17] package javax.ejb does not exist
G:\nm_poc\ejb\jar\src\main\java\com\cisco\nm\poc\inventory\ejb\InventorySess
ion.
java:[13,17] package javax.ejb does not exist
...
] package javax.ejb does not exist
G:\nm_poc\ejb\jar\src\main\java\com\cisco\nm\poc\inventory\ejb\InventorySess
ion.
java:[125,15] InventoryQueryResponse(java.util.Collection) in
com.cisco.nm.poc.
inventory.util.InventoryQueryResponse cannot be applied to ()
[INFO]
-------------------------------------------------------------------------
---
[INFO] Total time: 6 seconds
[INFO] Finished at: Thu Jun 09 11:24:30 CEST 2005
[INFO] Final Memory: 1M/7M
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE: M2 EJB basics
Posted by "Nathan Sowatskey (nsowatsk)" <ns...@cisco.com>.
Many thanks for the pointers. This is what worked:
<dependency>
<groupId>geronimo-spec</groupId>
<artifactId>geronimo-spec-j2ee</artifactId>
<version>1.4-rc4</version>
</dependency>
I was not sure what to do with the point about using a reference
implementation from Sun. What changes would I make to my pom.xml for that?
Regards
Nathan
-----Original Message-----
From: Brett Porter [mailto:brett.porter@gmail.com]
Sent: Thursday, June 09, 2005 12:25 PM
To: Maven Users List; nsowatsk@cisco.com
Cc: Nicolas Chalumeau
Subject: Re: M2 EJB basics
On 6/9/05, Nathan Sowatskey (nsowatsk) <ns...@cisco.com> wrote:
> 1 - I would normally (I think) wanted to have been able to refer to
> the file called jboss-j2ee.jar in the $JBOSS_HOME/server/all/lib dir.
> Of course I can copy and rename as I have below, but that doesn't seem
> right. What do other people do here?
You have a few options:
- install in the local repo, as you have
- use a reference implementation - j2ee from sun for compilation
- use geronimo-spec for compilation (it is available in the repo already)
> 2 - It seems as though the relationship between a dependency and a jar
> is 1:1. If I wanted to just add all of the jars in a given directory,
> how would I do that?
Create another dependency with packaging = pom, say j2ee-all, that declared
dependencies on all the others, then refer to that from your projects.
> [INFO]
> G:\nm_poc\ejb\jar\src\main\java\com\cisco\nm\poc\inventory\ejb\Invento
> ry ession.java:[125,15] InventoryQueryResponse(java.util.Collection)
> in com.cisco nm.poc.inventory.util.InventoryQueryResponse cannot be
> applied to ()
This appears to me to be a compile error in your code.
Cheers,
Brett
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: M2 EJB basics
Posted by Brett Porter <br...@gmail.com>.
On 6/9/05, Nathan Sowatskey (nsowatsk) <ns...@cisco.com> wrote:
> 1 - I would normally (I think) wanted to have been able to refer to the file
> called jboss-j2ee.jar in the $JBOSS_HOME/server/all/lib dir. Of course I can
> copy and rename as I have below, but that doesn't seem right. What do other
> people do here?
You have a few options:
- install in the local repo, as you have
- use a reference implementation - j2ee from sun for compilation
- use geronimo-spec for compilation (it is available in the repo already)
> 2 - It seems as though the relationship between a dependency and a jar is
> 1:1. If I wanted to just add all of the jars in a given directory, how would
> I do that?
Create another dependency with packaging = pom, say j2ee-all, that
declared dependencies on all the others, then refer to that from your
projects.
> [INFO]
> G:\nm_poc\ejb\jar\src\main\java\com\cisco\nm\poc\inventory\ejb\Inventory
> ession.java:[125,15] InventoryQueryResponse(java.util.Collection) in
> com.cisco
> nm.poc.inventory.util.InventoryQueryResponse cannot be applied to ()
This appears to me to be a compile error in your code.
Cheers,
Brett
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE: M2 EJB basics
Posted by "Nathan Sowatskey (nsowatsk)" <ns...@cisco.com>.
Thanks :-)
I have shown below what worked for me. A few questions though:
1 - I would normally (I think) wanted to have been able to refer to the file
called jboss-j2ee.jar in the $JBOSS_HOME/server/all/lib dir. Of course I can
copy and rename as I have below, but that doesn't seem right. What do other
people do here?
2 - It seems as though the relationship between a dependency and a jar is
1:1. If I wanted to just add all of the jars in a given directory, how would
I do that?
So, this is what did work for me.
In my pom.xml:
<dependency>
<groupId>jboss</groupId>
<artifactId>j2ee</artifactId>
<version>2.1</version>
</dependency>
And, in my repository I copy the jboss-j2ee.jar to j2ee-2.1.jar and create a
pom, like this:
G:\nm_poc\ejb\jar>ls "D:\Documents and
Settings\nsowatsk\.m2\repository\jboss\j2
ee\2.1"
j2ee-2.1.jar j2ee-2.1.pom
G:\nm_poc\ejb\jar>more "D:\Documents and
Settings\nsowatsk\.m2\repository\jboss\
j2ee\2.1/j2ee-2.1.pom"
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>jboss</groupId>
<artifactId>j2ee</artifactId>
<version>2.1</version>
</project>
So now I have:
G:\nm_poc\ejb\jar>m2 install
[INFO] inventory-service-pom: using locally installed snapshot
[INFO]
------------------------------------------------------------------------
---
[INFO] Building Inventory Service
[INFO]
------------------------------------------------------------------------
---
[INFO] maven-jar-plugin: resolved to version 2.0-alpha-2 from local
repository
[INFO] maven-resources-plugin: resolved to version 2.0-alpha-2 from local
repos
tory
[INFO] maven-compiler-plugin: resolved to version 2.0-alpha-2 from local
reposi
ory
[INFO] maven-surefire-plugin: resolved to version 2.0-alpha-2 from local
reposi
ory
[INFO] maven-install-plugin: resolved to version 2.0-alpha-2 from local
reposit
ry
[INFO] [resources:resources]
[INFO] [compiler:compile]
Compiling 17 source files to G:\nm_poc\ejb\jar\target\classes
[INFO]
------------------------------------------------------------------------
---
[INFO] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
---
[INFO] Reason: Compilation failure
[INFO]
------------------------------------------------------------------------
---
[INFO]
G:\nm_poc\ejb\jar\src\main\java\com\cisco\nm\poc\inventory\ejb\Inventory
ession.java:[125,15] InventoryQueryResponse(java.util.Collection) in
com.cisco
nm.poc.inventory.util.InventoryQueryResponse cannot be applied to ()
[INFO]
------------------------------------------------------------------------
---
[INFO] Total time: 6 seconds
[INFO] Finished at: Thu Jun 09 12:05:42 CEST 2005
[INFO] Final Memory: 1M/7M
[INFO]
------------------------------------------------------------------------
---
G:\nm_poc\ejb\jar>
-----Original Message-----
From: Nicolas Chalumeau [mailto:nicolas.chalumeau@gmail.com]
Sent: Thursday, June 09, 2005 11:41 AM
To: Maven Users List; nsowatsk@cisco.com
Subject: Re: M2 EJB basics
Hi Nathan
2005/6/9, Nathan Sowatskey (nsowatsk) <ns...@cisco.com>:
> Hi
>
> It may be that I too much of a newbie to Maven to be considering M2,
> but I am trying anyway :-)
>
> In the example below I have some EJB code that won't compile as it
> can't find the EJB jars.
>
> What I can't see is how to set the location of the EJB jars though. If
> this were Maven 1.x I would use properties as part of the solution,
> but for M2 I just don't know where to start.
>
> I half suspect that I need to create a dependency, but to what and
> where and how I don't know.
You have the solution here : you need to add a j2ee-XX.jar dependency in
your pom for this project. But as it will not be on ibiblio you need to
download and install it in your m2 repository manually.
>
> If someone wants to tell me that M2 is not ready for newbies, that's
> fine and I will go look at 1.x. If someone can help me get this to
> work though, then I will persevere and maybe help make M2 a better thing.
We all are newbies in M2 ;-) (only the great dev team is not...)
Nicolas,
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: M2 EJB basics
Posted by Nicolas Chalumeau <ni...@gmail.com>.
Hi Nathan
2005/6/9, Nathan Sowatskey (nsowatsk) <ns...@cisco.com>:
> Hi
>
> It may be that I too much of a newbie to Maven to be considering M2, but I
> am trying anyway :-)
>
> In the example below I have some EJB code that won't compile as it can't
> find the EJB jars.
>
> What I can't see is how to set the location of the EJB jars though. If this
> were Maven 1.x I would use properties as part of the solution, but for M2 I
> just don't know where to start.
>
> I half suspect that I need to create a dependency, but to what and where and
> how I don't know.
You have the solution here : you need to add a j2ee-XX.jar dependency
in your pom for this project. But as it will not be on ibiblio you
need to download and install it in your m2 repository manually.
>
> If someone wants to tell me that M2 is not ready for newbies, that's fine
> and I will go look at 1.x. If someone can help me get this to work though,
> then I will persevere and maybe help make M2 a better thing.
We all are newbies in M2 ;-) (only the great dev team is not...)
Nicolas,
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org