Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-dev] Passing additional parameters to maven buildet

These are really questions for the m2e-users list, m2e-dev is intended for developing m2e.

I believe C would need to be a parent of both A and B for that to work.


On 3 December 2012 09:25, Andrey Rusak <rusak@xxxxxx> wrote:

Hi Fred,

Thank you for your response. However I am not sure it helps me. I can not move all projects under one parent project. And even when specify a profile in pom.xml file, which should set property ${abc} – id does not help when Eclipse builds workspace.

Let me please provide you my scenario as a sample.

There are three projects (structure is very simple):

A

                pom.xml

                               imports project C

                               uses ${abc}

B

                pom.xml

                               imports project C

                               uses ${abc}

C (bom)

                pom.xml

                               define property value <abc>foo</abc>

 

I have created maven profile which activated by default and initializes property abc = foo

 

Now, I build project “C” – successfully;

When I build project “B” with maven option –Dabc=foo, the property is set for all projects to “foo” value.

Build project “B”. error occurs because property ${abc} is not initialized with vale in project “A”

 

BUT, I can not specify variable ${abc} to be used by m2e plugin when it resolves dependencies.

Any ideas?

 

 

From: Fred Bricon [mailto:fbricon@xxxxxxxxx]
Sent: Monday, December 03, 2012 3:01 PM
To: Andrey Rusak
Cc: Maven Integration for Eclipse developers mailing list


Subject: Re: [m2e-dev] Passing additional parameters to maven buildet

 

Either put the profile in your settings.xml or in a parent project all other projects will inherit from. Last option is to define the m2e profile on all of these projects

 

 

On Sat, Dec 1, 2012 at 12:20 PM, Andrey Rusak <rusak@xxxxxx> wrote:

Hi Fred and thank you for your fast response.

Yes I know how profile works, thanks. But there is another problem of how Maven initialize and inherits property values.

Let me please provide scenario. When I’m building project A, which has project B in dependency. Both of them use the same variable ${abc}, which I can define in maven profile as you are suggesting.

Then I perform build of project A. Maven applies variable value ${abc}=foo for project A, BUT it does not apply it for project B!

The problem is sorted only when I set variable value directly in command line like –Dabc=foo. Then Maven applies this variable value for all projects and their dependencies. It’s not a problem when you build projects from command line. You always can specify this variable.

But other hand is Eclipse, which tries to build workspace with “default” parameters, and I have no Idea how to pass this variable value to Eclipse to build my workspace properly.

 

 

From: Fred Bricon [mailto:fbricon@xxxxxxxxx]
Sent: Friday, November 30, 2012 6:29 PM
To: Andrey Rusak; Maven Integration for Eclipse developers mailing list
Subject: Re: [m2e-dev] Passing additional parameters to maven buildet

 

you can either create a m2e profile in your pom.xml, that will only be active when working within eclipse, like : 

 

 
 
 
 
<profiles>
 
 
 <profile>
   <id>m2e</id>
 
 
   <activation>
     <property>
 
 
       <name>m2e.version</name>
     </property>
   </activation>
   <properties>
     <abc>foo</abc>
   </properties>
 </profile>
</profiles>

Or set a similar profile in your settings.xml

 

HIH

 

Fred Bricon

 

 

On Fri, Nov 30, 2012 at 4:23 PM, Andrey Rusak <rusak@xxxxxx> wrote:

 

 Hi there,

I am trying to use custom variables in my project’s POM like ${abc}.

Normally this variable initialized from command line arguments when maven build starts, e.g. mvn –Dabc=123

However, when the variable in not initialized with value (I will not explain too much details why the variable is used for) build fails because the variable is used for dependency management. Actually it’s fine for me when projects built in Bamboo/Jenkins/etc. But we got problems in Eclipse workspace when it can not resolve dependencies due to missing parameter.

So, summary of my question is how to pass custom arguments/parameters in Eclipse maven builder, which resolves dependencies on workspace.

 

Thanks in advance for any assistance.

 

 

 

Best regards,

Andrey Rusak

 

 

 

 

Sent from Samsung mobile


_______________________________________________
m2e-dev mailing list
m2e-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/m2e-dev



 

--
"Have you tried turning it off and on again" - The IT Crowd



 

--
"Have you tried turning it off and on again" - The IT Crowd


_______________________________________________
m2e-dev mailing list
m2e-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/m2e-dev



Back to the top