Re: Exclude wb-resources into eclipse from maven

2012-11-16 Thread Barrie Treloar
Have you tried running with -X to see if the output is giving you any clues?

This could be a bug, but I dont use web stuff so can't tell.
Alternatively, just edit the generated file by hand to remove the
double entry before importing.

If you are super keen, grab the latest source, find the bug and submit
patch via jira.

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



Re: Aggregate modules and parallel builds

2012-11-16 Thread Ivan Dubrov
This approach is kind of error prone. The assembly I want to make basically
packages whole directory. So I want it to be invoked after _all_ submodules
are built, with an assumption that set of the submodules could change over
time and I don't want to fix assembling every time this happens.



On Fri, Nov 16, 2012 at 1:25 PM, Ansgar Konermann <
ansgar.konerm...@googlemail.com> wrote:

> Read this first (the useAllReactorProjects flag notes, especially):
>
>
> https://maven.apache.org/plugins/maven-assembly-plugin/examples/multimodule/module-binary-inclusion-simple.html
>
>
> https://maven.apache.org/plugins/maven-assembly-plugin/faq.html#module-binaries
>
> Create a new child module to produce the assembly, have this module depend
> on the child modules you want to include the binaries from AND use an
> assembly descriptor having useAllReactorPlugins set to true.
>
> Am 16.11.2012 22:06 schrieb "Ivan Dubrov" :
> >
> > Hi,
> >
> > During non-parallel build aggregate POMs are built last provided there is
> > no parent-child relationships between it and its submodules (correct me
> if
> > I am wrong).
> >
> > Is that preserved during parallel builds? Can I assume that root POM is
> > built after all its submodules are built? According to the build logs, it
> > seems like the answer is "no", but maybe I am missing something.
> >
> > If answer is "no", how can I ensure that aggregate POM is built last? For
> > example, I want to run assembly plugin after all submodules are built (in
> > parallel build)? Of course, I can run separate "mvn -N assembly:assembly"
> > command to assemble built stuff, but is there a way to do that during
> > regular build?
> > I don't want to specify dependencies explicitly since it could be
> > error-prone (submodules dependencies could change, for example).
> >
> > Can we have this convention back? Make
> > org.apache.maven.project.ProjectsSorter to add "weak" dependencies from
> > aggregate module to all its submodules?
> >
> > --
> > WBR,
> > Ivan Dubrov
>



-- 
WBR,
Ivan Dubrov


RE: Properties within source code

2012-11-16 Thread Nick Cuneo (ncuneo)
I agree this isn't the best approach, however I'm trying to do as much as 
possible with legacy code and trying to not make any changes to source code.

Thanks,
-Nick


-Original Message-
From: John Kramer [mailto:jkra...@mojiva.com] 
Sent: Friday, November 16, 2012 2:03 PM
To: Maven Users List
Subject: Re: Properties within source code

I know that this may not address your question directly, but I suggest that you 
change your approach.

Rather than build two different artifacts for debugging or not debugging, I 
suggest that you make the a runtime configuration.  Look into various logging 
frameworks (log4j, log back) that will allow this.  They are pretty flexible 
and should probably help you.

If they don't address your issue, you should look into using java system 
properties.  The tag  will allow you to set them in tests run with the 
surefire plugin.

You can also package a properties file with your code and use maven properties 
to filter that.  However, as far as I know, Maven only has the capability to 
filter resources (such as the aforementioned properties file), not java source 
code (and if it does have that capability, I would suggest not using it as it 
would screw up static source tools).


John Kramer
email: jkra...@mojiva.com
mobile: 314.435.2370
skype: kramer.mojiva
twitter: @KramerKnowsTech
0xCAFEBABE0032


From: "Nick Cuneo (ncuneo)" mailto:ncu...@cisco.com>>
Reply-To: Maven Users List 
mailto:users@maven.apache.org>>
Date: Friday, November 16, 2012 16:53 PM
To: "users@maven.apache.org" 
mailto:users@maven.apache.org>>
Subject: Properties within source code

Hi,

We are attempting to migrate our build environment from being very Ant-centric, 
to be Maven-centric.  We have a source file (Trace.java) that has a couple of 
variables that get set for debug/non-debug builds.  The code is as follows 
public boolean DEBUG = ${debug.enabled};

Obviously this won't compile as is, but with Ant we were able to replace that 
property at compile time so it would build the appropriate package.  I'm trying 
to get that same functionality with Maven... I've looked into trying to add the 
file as a resource and creating the property in the pom.xml.  I've also tried 
using the google-replace plugin, but that didn't seem to work well either.  Am 
I just not doing it right?  I'm learning Maven as I go so I figured that's a 
possibility.  I've tried doing searches on the subject with google and looking 
through maven documentation and it feels straightforward but just not working 
for me.

Example from pom:

true


...


${basedir}/src/trace

Trace.java




I see in the log that it's doing something with the file, maybe not what I was 
intending though:
[INFO] Copying 1 resource

Any help would be appreciative.


Thanks,
 Nick
[Description: http://www.cisco.com/web/europe/images/email/signature/logo02.jpg]

Nicholas Cuneo
Software Engineer
SPVTG
ncu...@cisco.com
Phone: 1-714-434-2344
Mobile: 1-949-243-4952



3500 Hyland Ave
Costa Mesa, CA
United States
Cisco.com

Download vCard[Description: Virtual Card 
File]


[Description: Think before you print.]Think before you print.
This email may contain confidential and privileged material for the sole use of 
the intended recipient. Any review, use, distribution or disclosure by others 
is strictly prohibited. If you are not the intended recipient (or authorized to 
receive for the recipient), please contact the sender by reply email and delete 
all copies of this message.
For corporate legal information go to:
http://www.cisco.com/web/about/doing_business/legal/cri/index.html







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



Re: Properties within source code

2012-11-16 Thread Stephen Connolly
There is support for generating source code from some form of template.
Usually requires a plugin for the "template" engine, or antrun and
build-helper:add-source

You would keep the "template" outside if src/main/java and then the
generated source goes to something like target/generated-source/... And
that path gets added as a source root.

But keep in mind the principle of environment agnostic artifacts. Tuning
logging levels is not such, so abusing to do such is a bad plan

On Friday, 16 November 2012, John Kramer wrote:

> I know that this may not address your question directly, but I suggest
> that you change your approach.
>
> Rather than build two different artifacts for debugging or not debugging,
> I suggest that you make the a runtime configuration.  Look into various
> logging frameworks (log4j, log back) that will allow this.  They are pretty
> flexible and should probably help you.
>
> If they don't address your issue, you should look into using java system
> properties.  The tag  will allow you to set them in tests run with
> the surefire plugin.
>
> You can also package a properties file with your code and use maven
> properties to filter that.  However, as far as I know, Maven only has the
> capability to filter resources (such as the aforementioned properties
> file), not java source code (and if it does have that capability, I would
> suggest not using it as it would screw up static source tools).
>
>
> John Kramer
> email: jkra...@mojiva.com 
>  >
> mobile: 314.435.2370
> skype: kramer.mojiva
> twitter: @KramerKnowsTech
> 0xCAFEBABE0032
>
>
> From: "Nick Cuneo (ncuneo)"  ncu...@cisco.com >>
> Reply-To: Maven Users List  users@maven.apache.org >>
> Date: Friday, November 16, 2012 16:53 PM
> To: "users@maven.apache.org 
> "
>   >>
> Subject: Properties within source code
>
> Hi,
>
> We are attempting to migrate our build environment from being very
> Ant-centric, to be Maven-centric.  We have a source file (Trace.java) that
> has a couple of variables that get set for debug/non-debug builds.  The
> code is as follows
> public boolean DEBUG = ${debug.enabled};
>
> Obviously this won’t compile as is, but with Ant we were able to replace
> that property at compile time so it would build the appropriate package.
>  I’m trying to get that same functionality with Maven… I’ve looked into
> trying to add the file as a resource and creating the property in the
> pom.xml.  I’ve also tried using the google-replace plugin, but that didn’t
> seem to work well either.  Am I just not doing it right?  I’m learning
> Maven as I go so I figured that’s a possibility.  I’ve tried doing searches
> on the subject with google and looking through maven documentation and it
> feels straightforward but just not working for me.
>
> Example from pom:
> 
> true
> 
> 
> …
> 
> 
> ${basedir}/src/trace
> 
>
> Trace.java
> 
> 
> 
>
> I see in the log that it’s doing something with the file, maybe not what I
> was intending though:
> [INFO] Copying 1 resource
>
> Any help would be appreciative.
>
>
> Thanks,
>  Nick
> [Description:
> http://www.cisco.com/web/europe/images/email/signature/logo02.jpg]
>
> Nicholas Cuneo
> Software Engineer
> SPVTG
> ncu...@cisco.com 
> Phone: 1-714-434-2344
> Mobile: 1-949-243-4952
>
>
>
> 3500 Hyland Ave
> Costa Mesa, CA
> United States
> Cisco.com
>
> Download vCard[Description: Virtual Card File]<
> http://wwwin-tools.cisco.com/dir/vcard/ncuneo.vcf>
>
>
> [Description: Think before you print.]Think before you print.
> This email may contain confidential and privileged material for the sole
> use of the intended recipient. Any review, use, distribution or disclosure
> by others is strictly prohibited. If you are not the intended recipient (or
> authorized to receive for the recipient), please contact the sender by
> reply email and delete all copies of this message.
> For corporate legal information go to:
> http://www.cisco.com/web/about/doing_business/legal/cri/index.html
>
>
>
>
>
>
>


Re: Properties within source code

2012-11-16 Thread John Kramer
I know that this may not address your question directly, but I suggest that you 
change your approach.

Rather than build two different artifacts for debugging or not debugging, I 
suggest that you make the a runtime configuration.  Look into various logging 
frameworks (log4j, log back) that will allow this.  They are pretty flexible 
and should probably help you.

If they don't address your issue, you should look into using java system 
properties.  The tag  will allow you to set them in tests run with the 
surefire plugin.

You can also package a properties file with your code and use maven properties 
to filter that.  However, as far as I know, Maven only has the capability to 
filter resources (such as the aforementioned properties file), not java source 
code (and if it does have that capability, I would suggest not using it as it 
would screw up static source tools).


John Kramer
email: jkra...@mojiva.com
mobile: 314.435.2370
skype: kramer.mojiva
twitter: @KramerKnowsTech
0xCAFEBABE0032


From: "Nick Cuneo (ncuneo)" mailto:ncu...@cisco.com>>
Reply-To: Maven Users List 
mailto:users@maven.apache.org>>
Date: Friday, November 16, 2012 16:53 PM
To: "users@maven.apache.org" 
mailto:users@maven.apache.org>>
Subject: Properties within source code

Hi,

We are attempting to migrate our build environment from being very Ant-centric, 
to be Maven-centric.  We have a source file (Trace.java) that has a couple of 
variables that get set for debug/non-debug builds.  The code is as follows
public boolean DEBUG = ${debug.enabled};

Obviously this won’t compile as is, but with Ant we were able to replace that 
property at compile time so it would build the appropriate package.  I’m trying 
to get that same functionality with Maven… I’ve looked into trying to add the 
file as a resource and creating the property in the pom.xml.  I’ve also tried 
using the google-replace plugin, but that didn’t seem to work well either.  Am 
I just not doing it right?  I’m learning Maven as I go so I figured that’s a 
possibility.  I’ve tried doing searches on the subject with google and looking 
through maven documentation and it feels straightforward but just not working 
for me.

Example from pom:

true


…


${basedir}/src/trace

Trace.java




I see in the log that it’s doing something with the file, maybe not what I was 
intending though:
[INFO] Copying 1 resource

Any help would be appreciative.


Thanks,
 Nick
[Description: http://www.cisco.com/web/europe/images/email/signature/logo02.jpg]

Nicholas Cuneo
Software Engineer
SPVTG
ncu...@cisco.com
Phone: 1-714-434-2344
Mobile: 1-949-243-4952



3500 Hyland Ave
Costa Mesa, CA
United States
Cisco.com

Download vCard[Description: Virtual Card 
File]


[Description: Think before you print.]Think before you print.
This email may contain confidential and privileged material for the sole use of 
the intended recipient. Any review, use, distribution or disclosure by others 
is strictly prohibited. If you are not the intended recipient (or authorized to 
receive for the recipient), please contact the sender by reply email and delete 
all copies of this message.
For corporate legal information go to:
http://www.cisco.com/web/about/doing_business/legal/cri/index.html








Aggregate modules and parallel builds

2012-11-16 Thread Ivan Dubrov
Hi,

During non-parallel build aggregate POMs are built last provided there is
no parent-child relationships between it and its submodules (correct me if
I am wrong).

Is that preserved during parallel builds? Can I assume that root POM is
built after all its submodules are built? According to the build logs, it
seems like the answer is "no", but maybe I am missing something.

If answer is "no", how can I ensure that aggregate POM is built last? For
example, I want to run assembly plugin after all submodules are built (in
parallel build)? Of course, I can run separate "mvn -N assembly:assembly"
command to assemble built stuff, but is there a way to do that during
regular build?
I don't want to specify dependencies explicitly since it could be
error-prone (submodules dependencies could change, for example).

Can we have this convention back? Make
org.apache.maven.project.ProjectsSorter to add "weak" dependencies from
aggregate module to all its children?

-- 
WBR,
Ivan Dubrov


Re: Aggregate modules and parallel builds

2012-11-16 Thread Ansgar Konermann
Read this first (the useAllReactorProjects flag notes, especially):

https://maven.apache.org/plugins/maven-assembly-plugin/examples/multimodule/module-binary-inclusion-simple.html

https://maven.apache.org/plugins/maven-assembly-plugin/faq.html#module-binaries

Create a new child module to produce the assembly, have this module depend
on the child modules you want to include the binaries from AND use an
assembly descriptor having useAllReactorPlugins set to true.

Am 16.11.2012 22:06 schrieb "Ivan Dubrov" :
>
> Hi,
>
> During non-parallel build aggregate POMs are built last provided there is
> no parent-child relationships between it and its submodules (correct me if
> I am wrong).
>
> Is that preserved during parallel builds? Can I assume that root POM is
> built after all its submodules are built? According to the build logs, it
> seems like the answer is "no", but maybe I am missing something.
>
> If answer is "no", how can I ensure that aggregate POM is built last? For
> example, I want to run assembly plugin after all submodules are built (in
> parallel build)? Of course, I can run separate "mvn -N assembly:assembly"
> command to assemble built stuff, but is there a way to do that during
> regular build?
> I don't want to specify dependencies explicitly since it could be
> error-prone (submodules dependencies could change, for example).
>
> Can we have this convention back? Make
> org.apache.maven.project.ProjectsSorter to add "weak" dependencies from
> aggregate module to all its submodules?
>
> --
> WBR,
> Ivan Dubrov


Aggregate modules and parallel builds

2012-11-16 Thread Ivan Dubrov
Hi,

During non-parallel build aggregate POMs are built last provided there is
no parent-child relationships between it and its submodules (correct me if
I am wrong).

Is that preserved during parallel builds? Can I assume that root POM is
built after all its submodules are built? According to the build logs, it
seems like the answer is "no", but maybe I am missing something.

If answer is "no", how can I ensure that aggregate POM is built last? For
example, I want to run assembly plugin after all submodules are built (in
parallel build)? Of course, I can run separate "mvn -N assembly:assembly"
command to assemble built stuff, but is there a way to do that during
regular build?
I don't want to specify dependencies explicitly since it could be
error-prone (submodules dependencies could change, for example).

Can we have this convention back? Make
org.apache.maven.project.ProjectsSorter to add "weak" dependencies from
aggregate module to all its submodules?

-- 
WBR,
Ivan Dubrov


Re: Compile and install sub-project on build

2012-11-16 Thread Wayne Fay
> It appears that your ProjectA depends on ProjectB.
> If you have the projectB listed as a dependency of project A and you do a
> build of projectA, you will get a jar file that contains all of the classes
> of projectA and ProjectB.

Ron's advice is sound and useful. I just wanted to clarify this comment.

You won't get a "jar file that contains all the classes of A and B" by
default if B is a dep of A and you simply build A. You would need to
use the assembly plugin (or dependency plugin, unpack mojo) or
something along those lines to produce such a "fat" jar. The default
would simply produce a jar with A's classes in it, and you'd need to
include B.jar on the classpath to run A successfully.

Wayne

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



Re: Why does mvn compiile using java 1.3?

2012-11-16 Thread Ron Wheeler

What IDE are you using.
If your colleagues are using the same pom, you need to look at your IDE 
setup.


For example, Eclipse will let you select any of the available compilers.

Ron

On 16/11/2012 8:21 AM, John Patrick wrote:

Jasper,

I also experience similar issues, it comes down to what version of
java you have installed, what version of the plugin you use and what
their respective defaults are. To avoid this I would explicitly state
version's of plugins and also a few other useful properties. I always
but at the least the following in every new project pom;


[...]
   
[...]
  
[...]
 
org.apache.maven.plugins
maven-compiler-plugin
2.5.1
 
[...]
  
[...]
   
[...]

[...]

[...]
   UTF-8
   1.6
   
${project.custom.java.version}
   
${project.custom.java.version}
   
${project.custom.encoding}
   
${project.custom.encoding}
   
${project.custom.encoding}
[...]



John

On 16 November 2012 09:50, Olivier Lamy  wrote:

Hi,
Which maven-compiler-plugin version are you using ?
Does your colleague set JAVA_HOME env var on windows ?

2012/11/16 Jasper Floor :

Hi,

For some reason mvn is compiling using java 1.3. I do not understand this
behavior. I have never seen this before and it doesn't do this on my
colleagues machine with the same project. The big difference is he is a
windows use and I am a linux user.

Apache Maven 3.0.4
Maven home: /usr/share/maven
Java version: 1.6.0_33, vendor: Sun Microsystems Inc.
Java home: /opt/jdk/jdk1.6.0_33/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.2.0-29-generic", arch: "amd64", family: "unix"

Its a Mint distro, but with my own java installed as I required the 1.6
  jdk.


mvg,
Jasper



--
Olivier Lamy
Talend: http://coders.talend.com
http://twitter.com/olamy | http://linkedin.com/in/olamy

-
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





--
Ron Wheeler
President
Artifact Software Inc
email: rwhee...@artifact-software.com
skype: ronaldmwheeler
phone: 866-970-2435, ext 102


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



Re: Compile and install sub-project on build

2012-11-16 Thread Ron Wheeler

On 16/11/2012 9:05 AM, mar wrote:

I'm not confused as to what kind of repository functionality Maven provides.
Maybe I should have named my original question "How do I build my
Maven-project?" since that's where my problem lies.

I have done more reading and experimenting; lots and lots of googling,
reading "Maven by Example" @
http://www.sonatype.com/books/mvnex-book/reference/ and searching for
solutions to the problems Maven has been spitting back at me. I have come to
wonder if I'm perhaps mistaken in believing that Maven is a build-tool,
since I can't imagine my setup to be that unorthodox.

Perhaps my examples so far have been too elaborate to explain what I'm
really trying to do. Please let me try to clarify the scenario:

1) I have a ProjectA that depends on a few globally accessible
maven-artifacts. ProjectA also has a dependency on ProjectB. Note that
ProjectB is not available as a built artifact.

Why not? it should be.


2) The source code for ProjectB comes bundled as a git submodule with
ProjectA. The desired relation between ProjectA and ProjectB is that
ProjectB should be built to be used whenever ProjectA is built.

Why. Once it is built and tested it should not be rebuilt.

(3) ProjectB lives in a separate git repository from ProjectA and should be
buildable on its own.

Good.

To summarize, the source code for ProjectA and ProjectB both live in git
repos. ProjectA is a maven project that has a dependency on a few common
artifacts, plus ProjectB. ProjectB is also a maven project, but its only
concern is to assemble itself.

What do you mean by assemble itself?
It appeared that form previous statements that it is just a simple 
artifact and once it is built and tested it is not much different from a 
library that you depend on from Apache.



In a perfect scenario, I would be able to build a fat JAR of both projects
by entering "mvn package" from the root of ProjectA. I would also be able to
build a fat JAR of ProjectB by issuing "mvn package" from the root of
ProjectB, (which is physically located one level below ProjectA.)
Maven install will build both projects. What does mvn package do that 
you need? Never used it.

Why do you want a fat B?
A "fat A" should do the trick.

What happens is that ProjectA can't find ProjectB, because there is no
backward reference from ProjectB to ProjectA I imagine. As the source code
of ProjectB will change along the way I'm working on ProjectA it feels
contrived to build and install it at every little change.
There is no link from B to A since B could be used by lots of other 
artifacts.
You need to build and test B everytime you change the code. A will just 
use the latest jar from the last build of B.



Another problem I am having is building ProjectB as a fat JAR. I have tried
using maven-shade-plugin but it reports a null error as the responsible
pom.xml is of type pom and thus doesn't produce a jar
of its own.

Not sure what to say about this. Perhaps someone else can help you.
We use the assembly plug-in.
This should be done in a 3rd project since it produces a new artifact.


I could possibly create a make.bat-file of sorts that first builds and
installs ProjectB, followed by a "mvn package" on ProjectA, but this feels
sub-optimal. And then there's the question of how I would end up with a fat
JAR..
Just rebuild B and run its unit tests (mvn install) each time you change 
the source.




I do want to use the central repository features of maven to pull external
dependencies, but I want my internal dependencies to be kept as source code,
if that make any sense..
Not really but it will work fine, you just have to manage the lifecycle 
of project B manually and coordinate with your other team member manually.




Best regards,
Martin


Ron Wheeler wrote

A Maven Repo is to Maven as a git server is to IntelliJ IDEA
A git server looks after sources and makes them available to the IDE
A Maven repo looks after jars and makes them available to builds.

If you want to share jars between project members, they have to be
someplace where they can be found.

When you build projectB and are ready to share it with the rest of your
project team, you *deploy* it to a Maven Repo that the rest of the team
can access.

If you don't have a Maven Repo, then each person is going to have to
build each artifact from the sources.

If you build and*install *an artifact, the jar and pom get put in your
repo on your workstation and then it is available to you for other
projects done on that same workstation but is not shared with anyone else.



On 15/11/2012 11:38 AM, mar wrote:

In my group? I'm sorry, I don't follow.

Right now we're a team of two. I'm in charge of the development of a
small
tool, but my mate might need to check out the code, possibly from outside
the company intranet. Maybe I'm getting the wrong end of how repositories
work. I realise that, by definition, there is a local repository every
machine that uses Maven, and I don't have a problem with artifa

Exclude wb-resources into eclipse from maven

2012-11-16 Thread adrien ruffie
Hello all,

 

I have the following pom.xml:

 





 
${basedir}/${target.dir}/classes

 



   org.apache.maven.plugins

   maven-compiler-plugin

   2.3.2

   

  1.6

  1.6

  UTF-8

   



   

  org.apache.maven.plugins

  maven-eclipse-plugin

  2.9

  

 

   bin

 
deploy.jars

   lib

   res

   target

 
WebContent

 

 

 
org.eclipse.jem.workbench.JavaEMFNature

 
org.eclipse.wst.common.project.facet.core.nature

 
org.eclipse.wst.jsdt.core.jsNature





 
org.eclipse.wst.jsdt.core.javascriptValidator

 
org.eclipse.jdt.core.javabuilder

 
org.eclipse.wst.common.project.facet.core.builder

 
org.eclipse.wst.validation.validationbuilder





 
org.eclipse.jdt.core.javanature

 
org.eclipse.wst.common.modulecore.ModuleCoreNature

  

 
Head2

  Head2

 2.0

 true

 true

  

   

 

But when I import into Eclipse, I have the following:
.settings/org.eclipse.wst.common.component

 





  

















  uses



   . 

 

Have in double:  how I can remove the double entry ?

And How I can remove   entry ?

 

Thank and best regards,

 

Adrien Ruffié



Re: Compile and install sub-project on build

2012-11-16 Thread mar
I'm not confused as to what kind of repository functionality Maven provides.
Maybe I should have named my original question "How do I build my
Maven-project?" since that's where my problem lies.

I have done more reading and experimenting; lots and lots of googling,
reading "Maven by Example" @
http://www.sonatype.com/books/mvnex-book/reference/ and searching for
solutions to the problems Maven has been spitting back at me. I have come to
wonder if I'm perhaps mistaken in believing that Maven is a build-tool,
since I can't imagine my setup to be that unorthodox.

Perhaps my examples so far have been too elaborate to explain what I'm
really trying to do. Please let me try to clarify the scenario:

1) I have a ProjectA that depends on a few globally accessible
maven-artifacts. ProjectA also has a dependency on ProjectB. Note that
ProjectB is not available as a built artifact.

2) The source code for ProjectB comes bundled as a git submodule with
ProjectA. The desired relation between ProjectA and ProjectB is that
ProjectB should be built to be used whenever ProjectA is built.

(3) ProjectB lives in a separate git repository from ProjectA and should be
buildable on its own. 

To summarize, the source code for ProjectA and ProjectB both live in git
repos. ProjectA is a maven project that has a dependency on a few common
artifacts, plus ProjectB. ProjectB is also a maven project, but its only
concern is to assemble itself.

In a perfect scenario, I would be able to build a fat JAR of both projects
by entering "mvn package" from the root of ProjectA. I would also be able to
build a fat JAR of ProjectB by issuing "mvn package" from the root of
ProjectB, (which is physically located one level below ProjectA.)

What happens is that ProjectA can't find ProjectB, because there is no
backward reference from ProjectB to ProjectA I imagine. As the source code
of ProjectB will change along the way I'm working on ProjectA it feels
contrived to build and install it at every little change.

Another problem I am having is building ProjectB as a fat JAR. I have tried
using maven-shade-plugin but it reports a null error as the responsible
pom.xml is of type pom and thus doesn't produce a jar
of its own.


I could possibly create a make.bat-file of sorts that first builds and
installs ProjectB, followed by a "mvn package" on ProjectA, but this feels
sub-optimal. And then there's the question of how I would end up with a fat
JAR..


I do want to use the central repository features of maven to pull external
dependencies, but I want my internal dependencies to be kept as source code,
if that make any sense..

Best regards,
Martin


Ron Wheeler wrote
> A Maven Repo is to Maven as a git server is to IntelliJ IDEA
> A git server looks after sources and makes them available to the IDE
> A Maven repo looks after jars and makes them available to builds.
> 
> If you want to share jars between project members, they have to be 
> someplace where they can be found.
> 
> When you build projectB and are ready to share it with the rest of your 
> project team, you *deploy* it to a Maven Repo that the rest of the team 
> can access.
> 
> If you don't have a Maven Repo, then each person is going to have to 
> build each artifact from the sources.
> 
> If you build and*install *an artifact, the jar and pom get put in your 
> repo on your workstation and then it is available to you for other 
> projects done on that same workstation but is not shared with anyone else.
> 
> 
> 
> On 15/11/2012 11:38 AM, mar wrote:
>> In my group? I'm sorry, I don't follow.
>>
>> Right now we're a team of two. I'm in charge of the development of a
>> small
>> tool, but my mate might need to check out the code, possibly from outside
>> the company intranet. Maybe I'm getting the wrong end of how repositories
>> work. I realise that, by definition, there is a local repository every
>> machine that uses Maven, and I don't have a problem with artifacts ending
>> up
>> there either. What I want to avoid is tying the project to a localized
>> repository such as "within the intranet, on server02.miniteam", as this
>> would defeat the purpose of portability.
>>
>> It would also be impossible for me to work on this from home during the
>> weekends like my boss wants me to ;)
> That is why you need a Maven Repo just in the same way that you need a 
> git server if you want to download the latest sources on the weekend.
>> After reading your last reply I was hoping that artifacts got published
>> to
>> the local repository (~/.m2 if I'm not mistaken?) automagically as they
>> were
>> built, but I'm still struggling. I set up a mock project described in the
>> outline below.
> They do if you do an install.
>>
>>
>> Module1 is a class that uses Module2 to reverse and print a string.
>> ProjectA
>> acts as the entry point and sends a string to Module1. ProjectB
>> represents
>> the separation of concern between the modules and ProjectA -- I might
>> want
>> to use my fancy revers

Re: Why does mvn compiile using java 1.3?

2012-11-16 Thread John Patrick
Jasper,

I also experience similar issues, it comes down to what version of
java you have installed, what version of the plugin you use and what
their respective defaults are. To avoid this I would explicitly state
version's of plugins and also a few other useful properties. I always
but at the least the following in every new project pom;


[...]
  
[...]
 
[...]

   org.apache.maven.plugins
   maven-compiler-plugin
   2.5.1

[...]
 
[...]
  
[...]
   
[...]
   
[...]
  UTF-8
  1.6
  
${project.custom.java.version}
  
${project.custom.java.version}
  
${project.custom.encoding}
  
${project.custom.encoding}
  
${project.custom.encoding}
[...]
   


John

On 16 November 2012 09:50, Olivier Lamy  wrote:
> Hi,
> Which maven-compiler-plugin version are you using ?
> Does your colleague set JAVA_HOME env var on windows ?
>
> 2012/11/16 Jasper Floor :
>> Hi,
>>
>> For some reason mvn is compiling using java 1.3. I do not understand this
>> behavior. I have never seen this before and it doesn't do this on my
>> colleagues machine with the same project. The big difference is he is a
>> windows use and I am a linux user.
>>
>> Apache Maven 3.0.4
>> Maven home: /usr/share/maven
>> Java version: 1.6.0_33, vendor: Sun Microsystems Inc.
>> Java home: /opt/jdk/jdk1.6.0_33/jre
>> Default locale: en_US, platform encoding: UTF-8
>> OS name: "linux", version: "3.2.0-29-generic", arch: "amd64", family: "unix"
>>
>> Its a Mint distro, but with my own java installed as I required the 1.6
>>  jdk.
>>
>>
>> mvg,
>> Jasper
>
>
>
> --
> Olivier Lamy
> Talend: http://coders.talend.com
> http://twitter.com/olamy | http://linkedin.com/in/olamy
>
> -
> 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: Why does mvn compiile using java 1.3?

2012-11-16 Thread Olivier Lamy
Hi,
Which maven-compiler-plugin version are you using ?
Does your colleague set JAVA_HOME env var on windows ?

2012/11/16 Jasper Floor :
> Hi,
>
> For some reason mvn is compiling using java 1.3. I do not understand this
> behavior. I have never seen this before and it doesn't do this on my
> colleagues machine with the same project. The big difference is he is a
> windows use and I am a linux user.
>
> Apache Maven 3.0.4
> Maven home: /usr/share/maven
> Java version: 1.6.0_33, vendor: Sun Microsystems Inc.
> Java home: /opt/jdk/jdk1.6.0_33/jre
> Default locale: en_US, platform encoding: UTF-8
> OS name: "linux", version: "3.2.0-29-generic", arch: "amd64", family: "unix"
>
> Its a Mint distro, but with my own java installed as I required the 1.6
>  jdk.
>
>
> mvg,
> Jasper



-- 
Olivier Lamy
Talend: http://coders.talend.com
http://twitter.com/olamy | http://linkedin.com/in/olamy

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



Why does mvn compiile using java 1.3?

2012-11-16 Thread Jasper Floor
Hi,

For some reason mvn is compiling using java 1.3. I do not understand this
behavior. I have never seen this before and it doesn't do this on my
colleagues machine with the same project. The big difference is he is a
windows use and I am a linux user.

Apache Maven 3.0.4
Maven home: /usr/share/maven
Java version: 1.6.0_33, vendor: Sun Microsystems Inc.
Java home: /opt/jdk/jdk1.6.0_33/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.2.0-29-generic", arch: "amd64", family: "unix"

Its a Mint distro, but with my own java installed as I required the 1.6
 jdk.


mvg,
Jasper