Announcement Announcement Module
Collapse
No announcement yet.
STS 3.1 - Automatic Workspace Configuration Question Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • STS 3.1 - Automatic Workspace Configuration Question

    Hi,

    I am working on a Project that creates a custom STS Plugin to pre-configure the STS Workspace and tc Server isntances in that Workspace.

    Basically what I wanted to do is, when STS is launched, then the custom plugin should;
    #1) checkout maven project(s) from source repository (subversion).
    #2) apply maven profiles (defined in the pom.xml) during the project build step.
    #3) create tc server instance and configure for that project.

    I looked at the following projects that provides the extension points for this purposes;
    https://github.com/SpringSource/ecli...ration-commons &
    https://github.com/SpringSource/ecli...ation-tcserver

    I was able to complete step #1 - using the extension point

    <extension-point id="com.springsource.sts.ide.configurator.particip ant" name="STS Workspace Configurator" schema="schema/participant.exsd" />

    I created custom configurable extensions by extending org.springsource.ide.eclipse.commons.configurator. ConfigurableExtension and that worked well,

    but now I am stuck at step #2 - need to apply the maven profiles and build the maven project.

    I am not sure whether there are any extension point avalilable to extend to customize the projetc build step.


    Please let me know if there are any suggestions to complete step #2 ?


    Thanks,
    Mohan

  • #2
    I can help you with #2, but I have no experience with #3. For this part, you will need to interact with the m2e plugin. I'd suggest checkout out the source code for that project at git.eclipse.org. There is a class called org.eclipse.m2e.actions.ExecutePomAction. This class can't be used directly, but you can see how a launch configuration is created and manipulated and profiles are applied. I'm assuming that you already know about how launch configurations work.

    I'll ask someone else on our team to answer how to configure tc server instances.

    Comment


    • #3
      Don't hesitate to ask if you need some clarification or more help.

      Comment


      • #4
        Hey!

        Regarding the tc Server configuration, you could take a look at:
        http://forum.springsource.org/showth...143#post439143

        (contains some pointers to code that shows how to do that)

        HTH,
        Martin

        Comment


        • #5
          Hi Andrew,

          I have to admit that, I am new to Eclipse Plugin development and so don't have much idea about how launch configuration works.

          But, as per your suggestion, I looked at the org.eclipse.m2e.actions.ExecutePomAction class, have these questions;

          1) Should a new ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfigurationWorkin gCopy) be created,
          by doing something similar to the method,
          private ILaunchConfiguration createLaunchConfiguration(IContainer basedir, String goal) {..} ?

          2) call doSave() method on the ILaunchConfiguration (step 1), do the same for all Maven Projects in the workspace.

          3) There is a preference file - 'org.eclipse.m2e.core.prefs' under .settings folder of the maven project, and it has a 'activeProfiles=' property - should this property be updated with the profile name Or step 1 will do ?

          Please let me know if the understanding is correct or let me know if there are any comments.

          Thanks,
          Mohan

          Comment


          • #6
            Hi Martin,

            Thanks for your suggestion about the tcserver configuration.

            I have to say that, I am working with the person posted the question to the forum and who has better understanding of the STS plugin development than myself, so we made some good progress with the custom tcserver configuration.

            Thanks,
            Mohan

            Comment


            • #7
              Originally posted by mohan_thirum View Post
              Hi Andrew,
              1) Should a new ILaunchConfiguration (org.eclipse.debug.core.ILaunchConfigurationWorkin gCopy) be created,
              by doing something similar to the method,
              private ILaunchConfiguration createLaunchConfiguration(IContainer basedir, String goal) {..} ?

              2) call doSave() method on the ILaunchConfiguration (step 1), do the same for all Maven Projects in the workspace.

              3) There is a preference file - 'org.eclipse.m2e.core.prefs' under .settings folder of the maven project, and it has a 'activeProfiles=' property - should this property be updated with the profile name Or step 1 will do ?
              1. Launch configurations should not be created directly. You must use the launchManager instance to create them. As happens in the createLaunchConfiguration method.

              2. Calling doSave will save all changes you made to the launch config. I don't know if this makes sense for you, but it is not a requirement.

              3. Don't try to alter the prefs file directly. In general, you should always use the Eclipse preferences api for working with preferences. I'm not exactly sure how that activeProfiles preference is used or set. It looks like it goes through the org.eclipse.m2e.core.internal.project.ResolverConf igurationIO class. So, if you have particular profiles that should be used, you can set them through that class.

              I am not an expert on m2e code, so you may have more luck posting to the m2e mailing list.

              Here is a good tutorial on preferences: http://www.vogella.com/articles/Ecli...s/article.html
              And a launch configuration tutorial is a little harder to find, but here is one: http://scg.unibe.ch/archive/projects...psePlugins.pdf

              Comment

              Working...
              X