AW: AW: Creating JAR file in WAR module leads to error in EAR creation

2020-11-13 Thread Hohl, Gerrit
Hello Karl Heinz,
Hello Jörg,


Thanks for your replies to my problem.


@Jörg: I would have assumed - as the EJB plugin also uses the type explicitly 
defined by the type of used module - that Maven would be able to resolve the 
coordinates to the correct artifact (means GAV and type).
https://github.com/apache/maven-ear-plugin/blob/b289e6c271d50172c871e528105dda81d6f702b8/src/main/java/org/apache/maven/plugins/ear/AbstractEarModule.java#L144
But it seems not the case. Or that they share the same information which is 
overwritten by the JAR installation / deployment.
The odd thing here is that everything works fine if I build the modules 
one-by-one.
So it seems not to be a general problem, but just a problem in case you do that 
in one build.
I would have expected that it always fails or always succeeds.


@Karl Heinz: Yes, the packaging is EJB.
That module is used in the web module and in the ear module as well as the 
client (which is not part of that Maven project, but an own Maven project).
Currently I'm using version 3.1.0 of the maven-ejb-plugin.
But I'm not sure how that is related to the problem as in all iteration - 
successful or not - I didn't change anything in aspect of the EJB.
Maybe you can elaborate on that a little bit?


In meantime I solved it with the maven-war-plugin's options:



XXX
XXX-pom
1.0.18

XXX-web
war




org.apache.maven.plugins
maven-war-plugin




${generated-webbapp-folder}



true
classes






This will create an additional XXX-web-1.0.18-classes.jar file.
The minus point is that this isn't as flexible as using the maven-jar-plugin.
But so far it works for me, also I have to do some copying via the 
maven-antrun-plugin as I need more files in the JAR than just the classes.

I guess that solution is also what Jörg mentioned.


Best regards,
Gerrit


P.S.: I recognized that I had a typo in my previous mail.
Of course the artifactId of the XXX-ear module is 
XXX-ear using ear.
Ups... But it is only in the excerpt. The real module's pom.xml is correct.

-Ursprüngliche Nachricht-
Von: Karl Heinz Marbaise  
Gesendet: Donnerstag, 12. November 2020 20:35
An: Maven Users List ; Hohl, Gerrit 
Betreff: Re: AW: Creating JAR file in WAR module leads to error in EAR creation

Hi,

On 12.11.20 14:13, Hohl, Gerrit wrote:
> Hello everyone,
>
>
> maybe some additional information will be helpful.
> The project structure is like (and also build in this order due to the 
> dependencies of the modules):
>
> - XXX-pom
>- XXX-ejb


My assumption is that ejb project uses packaging: ejb?
Where is the ejb module used? And how?

Which version of maven-ejb-plugin have you defined in your build?




>- XXX-web
>- XXX-ear
>
> Here the excerpt from the pom.xml of the XXX-web module:
>
> 
>   
>   XXX
>   XXX-pom
>   1.0.18
>   
>   XXX-web
>   war
>
>   
>   
>   
>   org.apache.maven.plugins
>   maven-war-plugin
>   
>   
>   
>   
> ${generated-webbapp-folder}
>   
>   
>   
>   
>   
>   org.apache.maven.plugins
>   maven-install-plugin
>   
>   
>   
>   jar-install
>   install
>   
>   install-file
>   
>   
>   
> ${project.build.directory}/${project.artifactId}-${project.version}.jar
>   jar
>   
> ${project.build.directory}/${project.artifactId}-${project.version}-javadoc.jar
>   
> ${project.build.directory}/${project.artifactId}-${project.version}-sources.jar
> 

Re: AW: Creating JAR file in WAR module leads to error in EAR creation

2020-11-12 Thread Karl Heinz Marbaise

XXX-web-${project.version}.war

/XXX
/








The  specifies that the type of the artifact must be WAR.
So the maven-ear-plugin tries to match that against the artifacts of the project 
(means the ).
And that also works.

But it seems that the maven-install-plugin and / or maven-deploy-plugin 
overwrite the file-path of the WAR at runtime of the Maven build in memory.
I don't know why and I also don't know how to prevent it.


Best regards,
Gerrit




Best would be to have an example project on Github or alike where we can
take a look on it ...and help here...


Kind regards
Karl Heinz Marbaise




-Ursprüngliche Nachricht-
Von: Hohl, Gerrit 
Gesendet: Donnerstag, 12. November 2020 13:33
An: Maven Users List (users@maven.apache.org) 
Betreff: Creating JAR file in WAR module leads to error in EAR creation

Hello everyone,

I have a project consisting of several modules, one being a WAR module and one 
being an EAR module.
The EAR module has a dependency on the WAR module.

It turned out that I need the classes of that WAR module also as a JAR file for 
our UI project.
So I added a install-file goal for the maven-install-plugin and a deploy-file 
goal for the maven-deploy-plugin.
The WAR module build now creates the JAR file successfully and also deploys it.

But now my EAR module fails:
Failed to execute goal org.apache.maven.plugins:maven-ear-plugin:3.0.2:ear 
(default-ear) on project XXX-ear: Cannot copy a directory: 
C:\XXX\XXX-pom\XXX-web\target\classes; Did you package/install 
XXX:XXX-web:war:1.0.18:compile? -> [Help 1]

I looked up the code of the maven-ear-plugin. It seems it the following line is 
the problem:
https://github.com/apache/maven-ear-plugin/blob/b289e6c271d50172c871e528105dda81d6f702b8/src/main/java/org/apache/maven/plugins/ear/EarMojo.java#L424
For some reason the file attribute of the Artifact object seems to contain the 
path to the classes directory if the JAR file is build.
If I uncomment the JAR file creation in the WAR module it seems it contains the 
WAR file path.

Things get even more interesting: When I created the JAR file, but build the 
WAR and the EAR independently (not by building the parent project), it works 
perfectly.
Seems something overwrites that information (the path of the WAR) and that 
information is kept also during the build step of the EAR file.

So I'm not sure what I'm doing wrong or how I can fix it.
Anyone faced a similar problem in the past?

Best regards,
Gerrit


-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org



Re: AW: Creating JAR file in WAR module leads to error in EAR creation

2020-11-12 Thread Jörg Schaible
Am Donnerstag, 12. November 2020, 14:13:42 CET schrieb Hohl, Gerrit:
> Hello everyone,
> 
> 
> maybe some additional information will be helpful.
> The project structure is like (and also build in this order due to the
> dependencies of the modules):
> 
> - XXX-pom
>   - XXX-ejb
>   - XXX-web
>   - XXX-ear

[snip]

You should not mix-up both artifacts for Maven. From Mavens PoV they are the 
same (because they have the same G:A:V). Look at the configuration options for 
the WAR plugin. You can generate automatically a jar file for the classes with 
an own classifier which is automatically attached. Use that one to refer in 
your EAR build.

Cheers,
Jörg



-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org



AW: Creating JAR file in WAR module leads to error in EAR creation

2020-11-12 Thread Hohl, Gerrit
x27;t know how to prevent it.


Best regards,
Gerrit


-Ursprüngliche Nachricht-
Von: Hohl, Gerrit  
Gesendet: Donnerstag, 12. November 2020 13:33
An: Maven Users List (users@maven.apache.org) 
Betreff: Creating JAR file in WAR module leads to error in EAR creation

Hello everyone,

I have a project consisting of several modules, one being a WAR module and one 
being an EAR module.
The EAR module has a dependency on the WAR module.

It turned out that I need the classes of that WAR module also as a JAR file for 
our UI project.
So I added a install-file goal for the maven-install-plugin and a deploy-file 
goal for the maven-deploy-plugin.
The WAR module build now creates the JAR file successfully and also deploys it.

But now my EAR module fails:
Failed to execute goal org.apache.maven.plugins:maven-ear-plugin:3.0.2:ear 
(default-ear) on project XXX-ear: Cannot copy a directory: 
C:\XXX\XXX-pom\XXX-web\target\classes; Did you package/install 
XXX:XXX-web:war:1.0.18:compile? -> [Help 1]

I looked up the code of the maven-ear-plugin. It seems it the following line is 
the problem:
https://github.com/apache/maven-ear-plugin/blob/b289e6c271d50172c871e528105dda81d6f702b8/src/main/java/org/apache/maven/plugins/ear/EarMojo.java#L424
For some reason the file attribute of the Artifact object seems to contain the 
path to the classes directory if the JAR file is build.
If I uncomment the JAR file creation in the WAR module it seems it contains the 
WAR file path.

Things get even more interesting: When I created the JAR file, but build the 
WAR and the EAR independently (not by building the parent project), it works 
perfectly.
Seems something overwrites that information (the path of the WAR) and that 
information is kept also during the build step of the EAR file.

So I'm not sure what I'm doing wrong or how I can fix it.
Anyone faced a similar problem in the past?

Best regards,
Gerrit


-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org



Creating JAR file in WAR module leads to error in EAR creation

2020-11-12 Thread Hohl, Gerrit
Hello everyone,

I have a project consisting of several modules, one being a WAR module and one 
being an EAR module.
The EAR module has a dependency on the WAR module.

It turned out that I need the classes of that WAR module also as a JAR file for 
our UI project.
So I added a install-file goal for the maven-install-plugin and a deploy-file 
goal for the maven-deploy-plugin.
The WAR module build now creates the JAR file successfully and also deploys it.

But now my EAR module fails:
Failed to execute goal org.apache.maven.plugins:maven-ear-plugin:3.0.2:ear 
(default-ear) on project XXX-ear: Cannot copy a directory: 
C:\XXX\XXX-pom\XXX-web\target\classes; Did you package/install 
XXX:XXX-web:war:1.0.18:compile? -> [Help 1]

I looked up the code of the maven-ear-plugin. It seems it the following line is 
the problem:
https://github.com/apache/maven-ear-plugin/blob/b289e6c271d50172c871e528105dda81d6f702b8/src/main/java/org/apache/maven/plugins/ear/EarMojo.java#L424
For some reason the file attribute of the Artifact object seems to contain the 
path to the classes directory if the JAR file is build.
If I uncomment the JAR file creation in the WAR module it seems it contains the 
WAR file path.

Things get even more interesting: When I created the JAR file, but build the 
WAR and the EAR independently (not by building the parent project), it works 
perfectly.
Seems something overwrites that information (the path of the WAR) and that 
information is kept also during the build step of the EAR file.

So I'm not sure what I'm doing wrong or how I can fix it.
Anyone faced a similar problem in the past?

Best regards,
Gerrit



Re: EAR Creation

2011-08-22 Thread Anders Hammar
Yes, you do this as a multi-module project. Anything else is simply
wrong (= will cause you problems) in Maven land.

/Anders

On Tue, Aug 23, 2011 at 07:31, Yuvaraj Vanarase
 wrote:
> Well, this seems to me little bit odd.
> Anyways, I believe you should have multi-module maven structure project. 
> Where, one of the modules/parent has EAR packaging and depends on other 
> modules (one of them then would have war packaging).
>
> For example,
>
> 1.
> You have a Parent POM which defines modules may be like:
>
> 
>                Module-EAR
>                Module-War
>  
>
> 2.
> POM of Module EAR would have packaging as EAR and defines dependency of 
> Module-War.
>
> 3.
> POM of Module War would have packaging as WAR.
>
>
> Regards,
> Yuvaraj
>
> Yuvaraj Vanarase,
> Lead Technology - Software
> Phone: +91.20.40262000 Ext 2305|Mobile: +91.9850818870 
> | http://www.synechron.com
> SYNECHRON -
> - Top 10 Best IT Employers for 4 consecutive years (link).
> - Celebrating 10 Years!
>
> -Original Message-
> From: anamika gupta [mailto:anam...@hcl.com]
> Sent: Tuesday, August 23, 2011 10:23 AM
> To: users@maven.apache.org
> Subject: EAR Creation
>
> Hi,
>
>   I have to create the ear file of an application which consists a war file
> of the same application.
>
> Can you please tell me what entries to write in pom.xml so that it creates
> the war file of the module and then package the same war file into the ear
> file.
>
> Any help would be greatly appreciated
>
> --
> View this message in context: 
> http://maven.40175.n5.nabble.com/EAR-Creation-tp4725469p4725469.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>
>

-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org



RE: EAR Creation

2011-08-22 Thread Yuvaraj Vanarase
Well, this seems to me little bit odd. 
Anyways, I believe you should have multi-module maven structure project. Where, 
one of the modules/parent has EAR packaging and depends on other modules (one 
of them then would have war packaging). 

For example,

1.
You have a Parent POM which defines modules may be like:


Module-EAR
Module-War
  

2.
POM of Module EAR would have packaging as EAR and defines dependency of 
Module-War.

3.
POM of Module War would have packaging as WAR.


Regards,
Yuvaraj

Yuvaraj Vanarase,
Lead Technology - Software
Phone: +91.20.40262000 Ext 2305|Mobile: +91.9850818870 
| http://www.synechron.com
SYNECHRON - 
- Top 10 Best IT Employers for 4 consecutive years (link).
- Celebrating 10 Years!

-Original Message-
From: anamika gupta [mailto:anam...@hcl.com] 
Sent: Tuesday, August 23, 2011 10:23 AM
To: users@maven.apache.org
Subject: EAR Creation

Hi,

   I have to create the ear file of an application which consists a war file
of the same application. 

Can you please tell me what entries to write in pom.xml so that it creates
the war file of the module and then package the same war file into the ear
file.

Any help would be greatly appreciated

--
View this message in context: 
http://maven.40175.n5.nabble.com/EAR-Creation-tp4725469p4725469.html
Sent from the Maven - Users mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org


-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org



EAR Creation

2011-08-22 Thread anamika gupta
Hi,

   I have to create the ear file of an application which consists a war file
of the same application. 

Can you please tell me what entries to write in pom.xml so that it creates
the war file of the module and then package the same war file into the ear
file.

Any help would be greatly appreciated

--
View this message in context: 
http://maven.40175.n5.nabble.com/EAR-Creation-tp4725469p4725469.html
Sent from the Maven - Users mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org



Re: maven 2 and ear creation problem

2007-02-18 Thread Tony Ambrozie

Can you post the relevant section of the mvn output?  You may want to enable
stacktraces (mvn ...-X...)

Thanks

On 2/18/07, xyz <[EMAIL PROTECTED]> wrote:



Hi all,

We are using maven 2.0.4 and when we build the ear file with the pom.xml,
we
get a null pointer exception. Can some one please tell us possible causes
for this or possible areas where we need to look for solving this issue.
We
are using maven ear plugin to build the ear.

Thanks
--
View this message in context:
http://www.nabble.com/maven-2-and-ear-creation-problem-tf3250557s177.html#a9036137
Sent from the Maven - Users mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




maven 2 and ear creation problem

2007-02-18 Thread xyz

Hi all,

We are using maven 2.0.4 and when we build the ear file with the pom.xml, we
get a null pointer exception. Can some one please tell us possible causes
for this or possible areas where we need to look for solving this issue. We
are using maven ear plugin to build the ear.

Thanks
-- 
View this message in context: 
http://www.nabble.com/maven-2-and-ear-creation-problem-tf3250557s177.html#a9036137
Sent from the Maven - Users mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]