Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-dev] Reading a plugin's configuration during project configuration

Hi,

Am 28.10.2011 um 20:40 schrieb Ian Robertson:

> The main unpleasantness is getting the field values by reflection. The class loader for configuredMojo will almost certainly not be the class loader for your configurator, so reflection will really be your only option.

That worked for me, thanks!

Still, I now have a problem in my custom BuildParticipant, a buildContext.refresh(outputDirectory) has no effect at all on my Eclipse workspace. I still have to refresh manually (pressing F5) to update the generated content in that folder. I am doing nothing more than calling...

  @Override
  public Set<IProject> build(int kind, IProgressMonitor monitor) throws Exception {
    
    Set<IProject> result = null;
    
    IMaven maven = MavenPlugin.getMaven();
    BuildContext buildContext = this.getBuildContext();
    
    if (!buildContext.isIncremental()) {
      
      result = super.build(kind, monitor);
      
      File outputDirectory = maven.getMojoParameterValue(
          this.getSession(),
          this.getMojoExecution(),
          Constants.OUTPUTDIRECTORY_PARAMETER,
          File.class);
      
      outputDirectory = outputDirectory != null ? outputDirectory : new File(Constants.DEFAULT_OUTPUT_DIRECTORY);
      buildContext.refresh(outputDirectory);
      
    }
    
    return result;
  }

Is that expected behavior?

Viele Grüße

-- 
Dipl.-Inform. Antonio Navarro Pérez               Software Engineering
Lehrstuhl für Software Engineering              RWTH Aachen University         
Ahornstraße 55, Raum 4310, D-52074 Aachen             perez@xxxxxxxxxx
Phone ++49 241 80-21342 / Fax -22218            http://www.se-rwth.de/

Back to the top