Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eclipse (M2E) is happier when this is used as Maven plugin instead of an extension #34

Closed
vorburger opened this issue Jul 23, 2018 · 3 comments
Milestone

Comments

@vorburger
Copy link

vorburger commented Jul 23, 2018

This issue was originally titled "Eclipse p2 site to be able to install this for M2E support without having to manually DL and copy a JAR around", but I subsequently found a much simpler / better solution, see comment; this description is as initially submitted, but is no longer what this issue is about - I'm now just suggesting to update the README.

In an ideal world, the process described here https://github.com/trustin/os-maven-plugin#issues-with-eclipse-m2e-or-other-ides as:

If you are using Eclipse, you need to install an additional Eclipse plugin ...). Download os-maven-plugin-1.6.0.jar and put it into the <ECLIPSE_HOME>/plugins directory.

could be made much smoother if this project published not only an Eclipse plugin JAR to Maven central, but a full Eclipse p2 site incl. an Eclipse feature. Then one could use the regular Help > Install New Software, or have e.g. an Eclipse Oomph Setup model such as https://github.com/vorburger/opendaylight-eclipse-setup install it, or list it in the M2E known extension catalog so that its (M2E's) wizard proposes to automatically download it with 1 click.

Would you welcome a contribution to this project which adds the required Eclipse feature and p2 site, built via the Tycho Maven extension, and if so would you then be willing to deploy that to Maven central?

This has come up e.g. in the context of etcd-io/jetcd#340.

@vorburger
Copy link
Author

Hey @trustin @hhoffstaette @nmittler @marko-asplund @jimmyMaci re. using os-maven-plugin in Eclipse, check this out:

<project xmlns="http://maven.apache.org/POM/4.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>test</groupId>
  <artifactId>test</artifactId>
  <version>0.0.1-SNAPSHOT</version>

  <dependencies>
    <dependency>
      <groupId>io.netty</groupId>
      <artifactId>netty-tcnative-boringssl-static</artifactId>
      <version>2.0.12.Final</version>
      <classifier>${os.detected.classifier}</classifier>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>kr.motd.maven</groupId>
        <artifactId>os-maven-plugin</artifactId>
        <version>1.6.0</version>
        <extensions>true</extensions>
        <executions>
          <execution>
            <phase>validate</phase>
            <goals>
              <goal>detect</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
    <pluginManagement>
      <plugins>
        <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
        <plugin>
          <groupId>org.eclipse.m2e</groupId>
          <artifactId>lifecycle-mapping</artifactId>
          <version>1.0.0</version>
          <configuration>
            <lifecycleMappingMetadata>
              <pluginExecutions>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>kr.motd.maven</groupId>
                    <artifactId>os-maven-plugin</artifactId>
                    <versionRange>[1.6.0,)</versionRange>
                    <goals>
                      <goal>detect</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <execute></execute>
                  </action>
                </pluginExecution>
              </pluginExecutions>
            </lifecycleMappingMetadata>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
</project>

This works great - and give me working os.detected.classifier in Eclipse, WITHOUT having to "Download os-maven-plugin-1.6.0.jar and put it into the <ECLIPSE_HOME>/plugins directory." - cool, no?

Are there any impacts of using it as a plugin with <extensions>true instead of an extension that I'm missing?

Do you want a PR with an update to the README with this?

@vorburger vorburger changed the title Eclipse p2 site to be able to install this for M2E support without having to manually DL and copy a JAR around Eclipse (M2E) is happier when this is used as Maven plugin instead of an extension Aug 14, 2018
vorburger added a commit to vorburger/jetcd that referenced this issue Aug 14, 2018
This lets it run in Eclipse under M2E as well, so that the dependency
netty-tcnative-boringssl-static with can be resolved with its
<classifier>${os.detected.classifier}.

see also trustin/os-maven-plugin#34

This concludes and fully fixes
etcd-io#340 - one can now (cleanly)
import jetcd into an Eclipse workspace using M2E.
lburgazzoli pushed a commit to etcd-io/jetcd that referenced this issue Aug 14, 2018
This lets it run in Eclipse under M2E as well, so that the dependency
netty-tcnative-boringssl-static with can be resolved with its
<classifier>${os.detected.classifier}.

see also trustin/os-maven-plugin#34

This concludes and fully fixes
#340 - one can now (cleanly)
import jetcd into an Eclipse workspace using M2E.
@szab100
Copy link

szab100 commented Sep 7, 2018

Haha, awesome! I got to the exact same conclusion and solution yesterday! I was going to post it here to help others, then found this issue.. I believe this should be used as a plugin and you might even be better remove the extension and Eclipse plugin interfaces implementation (so, as a breaking change) and add the explanation to the README, so users' life can be easier. Unless there are features of the plugin unavailable this way, I haven't tested it for anything else than using it with the protoc compiler maven plugin.

@trustin
Copy link
Owner

trustin commented Oct 13, 2018

Thank you for the detailed report. @sergei-ivanov has updated the README.md. Will not release 1.6.1.

@trustin trustin closed this as completed Oct 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants