You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/06/22 04:28:03 UTC

[GitHub] [apisix-java-plugin-runner] ericluoliu opened a new pull request, #153: Deploy JAR to Maven Central Repository

ericluoliu opened a new pull request, #153:
URL: https://github.com/apache/apisix-java-plugin-runner/pull/153

   Please answer these questions before submitting a pull request
   
   - Why submit this pull request?
   - [ ] Bugfix
   - [x] New feature provided
   - [ ] Improve performance
   
   ___
   ### New feature or improvement
   Updated pom.xml files to allow deployment of JAR to Maven Central Repository. This will allow users to download the JAR from the Maven Repository and build their plugins without having to clone the source code. 
   
   I have deployed a test JAR to Maven Central (https://search.maven.org/search?q=io.github.ericluoliu) under my GAV coordinates, and I have used this JAR by referencing it as a dependency in pom.xml to build a functional (end-to-end) demo plugin in a new Java SpringBoot project. 
   
   - Source branch: main branch on https://github.com/ericluoliu/apisix-java-plugin-runner
   
   - Related commits and pull requests: N/A
   
   - Target branch: main branch on https://github.com/apache/apisix-java-plugin-runner
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-java-plugin-runner] tzssangglass commented on a diff in pull request #153: feat: deploy jar to Maven Central repository

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on code in PR #153:
URL: https://github.com/apache/apisix-java-plugin-runner/pull/153#discussion_r907153751


##########
runner-starter/src/main/java/org/apache/apisix/plugin/runner/MyClassLoader.java:
##########
@@ -0,0 +1,51 @@
+package org.apache.apisix.plugin.runner;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
+
+public class MyClassLoader extends ClassLoader {
+    public MyClassLoader(ClassLoader parent) {
+        super(parent);
+    }
+
+    @Override
+    public Class<?> loadClass(String name) throws ClassNotFoundException {
+
+        if(!"org.apache.apisix.plugin.runner.filter.RewriteRequestDemoFilter".equals(name)){
+            return super.loadClass(name);
+        }
+        try {
+            String url = "file:/home/parallels/Documents/apisix-java-plugin-runner/runner-plugin/target/classes/org/apache/apisix/plugin/runner/filter/RewriteRequestDemoFilter.class";
+            URL myUrl = new URL(url);
+            URLConnection connection = myUrl.openConnection();
+            InputStream input = connection.getInputStream();
+            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+            int data = input.read();
+
+            while(data != -1){
+                buffer.write(data);
+                data = input.read();
+            }
+
+            input.close();
+
+            byte[] classData = buffer.toByteArray();
+
+            return defineClass("org.apache.apisix.plugin.runner.filter.RewriteRequestDemoFilter",
+                    classData, 0, classData.length);
+
+        } catch (MalformedURLException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+        return null;
+    }
+
+
+}

Review Comment:
   Is this the code related to hot loading? If so, then it is not needed in this PR. We can submit another PR to add functionality about hotloading. A PR should be kept pure.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-java-plugin-runner] tzssangglass commented on pull request #153: feat: deploy jar to Maven Central repository

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on PR #153:
URL: https://github.com/apache/apisix-java-plugin-runner/pull/153#issuecomment-1167088340

   Hi bro @dmsolr , would you be interested in reviewing this PR?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-java-plugin-runner] tzssangglass commented on a diff in pull request #153: feat: deploy jar to Maven Central repository

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on code in PR #153:
URL: https://github.com/apache/apisix-java-plugin-runner/pull/153#discussion_r907148378


##########
README.md:
##########
@@ -53,4 +53,4 @@ in your own environment.
 License
 -------
 
-[Apache 2.0 LICENSE](./LICENSE)
\ No newline at end of file
+[Apache 2.0 LICENSE](./LICENSE)

Review Comment:
   we don't need to change this file?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-java-plugin-runner] tzssangglass commented on pull request #153: feat: deploy jar to Maven Central repository

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on PR #153:
URL: https://github.com/apache/apisix-java-plugin-runner/pull/153#issuecomment-1167083654

   we don't need to push `apisix-java-plugin-runner-0.2.0-src.tgz` , it's a bin file.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-java-plugin-runner] ericluoliu commented on a diff in pull request #153: feat: deploy jar to Maven Central repository

Posted by GitBox <gi...@apache.org>.
ericluoliu commented on code in PR #153:
URL: https://github.com/apache/apisix-java-plugin-runner/pull/153#discussion_r907678632


##########
runner-starter/src/main/java/org/apache/apisix/plugin/runner/MyClassLoader.java:
##########
@@ -0,0 +1,51 @@
+package org.apache.apisix.plugin.runner;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
+
+public class MyClassLoader extends ClassLoader {
+    public MyClassLoader(ClassLoader parent) {
+        super(parent);
+    }
+
+    @Override
+    public Class<?> loadClass(String name) throws ClassNotFoundException {
+
+        if(!"org.apache.apisix.plugin.runner.filter.RewriteRequestDemoFilter".equals(name)){
+            return super.loadClass(name);
+        }
+        try {
+            String url = "file:/home/parallels/Documents/apisix-java-plugin-runner/runner-plugin/target/classes/org/apache/apisix/plugin/runner/filter/RewriteRequestDemoFilter.class";
+            URL myUrl = new URL(url);
+            URLConnection connection = myUrl.openConnection();
+            InputStream input = connection.getInputStream();
+            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+            int data = input.read();
+
+            while(data != -1){
+                buffer.write(data);
+                data = input.read();
+            }
+
+            input.close();
+
+            byte[] classData = buffer.toByteArray();
+
+            return defineClass("org.apache.apisix.plugin.runner.filter.RewriteRequestDemoFilter",
+                    classData, 0, classData.length);
+
+        } catch (MalformedURLException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+        return null;
+    }
+
+
+}

Review Comment:
   Yes, this is hot loading. I didn't realize I was working in the same git branch as before, and I must have accidentally committed all of those changes to this PR. Let me fix that.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-java-plugin-runner] ericluoliu commented on pull request #153: feat: deploy jar to Maven Central repository

Posted by GitBox <gi...@apache.org>.
ericluoliu commented on PR #153:
URL: https://github.com/apache/apisix-java-plugin-runner/pull/153#issuecomment-1167990428

   @tzssangglass @dmsolr 
   Hello, I over-cluttered this PR with commits from trying to revert and reset the Git commit history. I've made a fresh PR that can be found here: (https://github.com/apache/apisix-java-plugin-runner/pull/155). Apologies, and thanks for your understanding.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix-java-plugin-runner] ericluoliu closed pull request #153: feat: deploy jar to Maven Central repository

Posted by GitBox <gi...@apache.org>.
ericluoliu closed pull request #153: feat: deploy jar to Maven Central repository
URL: https://github.com/apache/apisix-java-plugin-runner/pull/153


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org