Jelajahi Sumber

hsweb-module.json

zhouhao 6 tahun lalu
induk
melakukan
c2a8c19740

+ 9 - 0
hsweb-commons/hsweb-commons-controller/pom.xml

@@ -32,6 +32,15 @@
 
     <description>通用增删改查-通用Controller模块</description>
 
+    <build>
+        <resources>
+            <resource>
+                <directory>src/main/resources</directory>
+                <filtering>true</filtering>
+            </resource>
+        </resources>
+    </build>
+
     <dependencies>
         <dependency>
             <groupId>org.hswebframework.web</groupId>

+ 9 - 0
hsweb-commons/hsweb-commons-controller/src/main/resources/hsweb-module.json

@@ -0,0 +1,9 @@
+{
+  "groupId": "${project.groupId}",
+  "artifactId": "${project.artifactId}",
+  "path": "hsweb-commons/hsweb-commons-controller",
+
+  "gitCommitHash": "${git.commit.hash}",
+  "gitRepository": "http://github.com/hs-web/hsweb-framework",
+  "version": "${project.version}"
+}

+ 8 - 1
hsweb-commons/hsweb-commons-service/hsweb-commons-service-simple/pom.xml

@@ -32,7 +32,14 @@
     <artifactId>hsweb-commons-service-simple</artifactId>
 
     <description>通用增删改查-通用服务本地实现模块</description>
-
+    <build>
+        <resources>
+            <resource>
+                <directory>src/main/resources</directory>
+                <filtering>true</filtering>
+            </resource>
+        </resources>
+    </build>
     <dependencies>
         <dependency>
             <groupId>org.slf4j</groupId>

+ 8 - 0
hsweb-commons/hsweb-commons-service/hsweb-commons-service-simple/src/main/resources/hsweb-module.json

@@ -0,0 +1,8 @@
+{
+  "groupId": "${project.groupId}",
+  "artifactId": "${project.artifactId}",
+  "path": "hsweb-commons/hsweb-commons-service/hsweb-commons-service-simple",
+  "gitCommitHash": "${git.commit.hash}",
+  "gitRepository": "http://github.com/hs-web/hsweb-framework",
+  "version": "${project.version}"
+}

+ 21 - 0
hsweb-commons/hsweb-commons-utils/src/main/java/org/hswebframework/web/ModuleUtils.java

@@ -6,6 +6,7 @@ import lombok.Setter;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.core.io.Resource;
 import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
+import org.springframework.util.ClassUtils;
 import org.springframework.util.StringUtils;
 
 import java.util.Map;
@@ -87,6 +88,8 @@ public abstract class ModuleUtils {
 
         private String groupId;
 
+        private String path;
+
         private String artifactId;
 
         private String gitCommitHash;
@@ -97,6 +100,24 @@ public abstract class ModuleUtils {
 
         private String version;
 
+        public String getGitLocation() {
+            String gitCommitHash = this.gitCommitHash;
+            if (gitCommitHash.contains("$")) {
+                gitCommitHash = "master";
+            }
+            return gitRepository + "/blob/" + gitCommitHash + "/" + path + "/";
+        }
+
+        public String getGitClassLocation(Class clazz) {
+            return getGitLocation() + "src/main/java/" + (ClassUtils.getPackageName(clazz).replace(".", "/"))
+                    + "/" + clazz.getSimpleName() + ".java";
+        }
+
+        public String getGitClassLocation(Class clazz, long line, long lineTo) {
+            return getGitLocation() + "src/main/java/" + (ClassUtils.getPackageName(clazz).replace(".", "/"))
+                    + "/" + clazz.getSimpleName() + ".java#L" + line + "-" + "L" + lineTo;
+        }
+
         public String getId() {
             if (StringUtils.isEmpty(id)) {
                 id = groupId + "/" + artifactId;

+ 2 - 2
hsweb-commons/hsweb-commons-utils/src/test/java/org/hswebframework/web/ModuleUtilsTest.java

@@ -4,7 +4,6 @@ import org.junit.Assert;
 import org.junit.Test;
 import org.slf4j.Logger;
 
-import static org.junit.Assert.*;
 
 /**
  * @author zhouhao
@@ -18,7 +17,8 @@ public class ModuleUtilsTest {
         Assert.assertNotNull(moduleInfo);
         Assert.assertFalse(moduleInfo.isNone());
         Assert.assertEquals(moduleInfo.getArtifactId(),"hsweb-commons-utils");
-
+        System.out.println(moduleInfo.getGitLocation());
+        System.out.println(moduleInfo.getGitClassLocation(Maps.class,10,12));
         ModuleUtils.ModuleInfo noneInfo = ModuleUtils.getModuleByClass(Logger.class);
         Assert.assertNotNull(noneInfo);
         Assert.assertTrue(noneInfo.isNone());

+ 2 - 1
hsweb-commons/hsweb-commons-utils/src/test/resources/hsweb-module.json

@@ -1,7 +1,8 @@
 {
   "groupId": "${project.groupId}",
   "artifactId": "${project.artifactId}",
-  "parent": "${parent.groupId}/${parent.artifactId}",
+  "path": "hsweb-commons/hsweb-commons-utils",
+
   "gitCommitHash": "${git.commit.hash}",
   "gitRepository": "http://github.com/hs-web/hsweb-framework",
   "version": "${project.version}"

+ 13 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-local/pom.xml

@@ -11,6 +11,19 @@
 
     <artifactId>hsweb-system-authorization-local</artifactId>
 
+    <build>
+        <resources>
+            <resource>
+                <directory>src/main/resources</directory>
+                <filtering>true</filtering>
+            </resource>
+            <resource>
+                <directory>src/main/resources/org</directory>
+                <filtering>false</filtering>
+            </resource>
+        </resources>
+    </build>
+
     <description>业务模块-权限管理本地实现</description>
     <dependencies>
         <dependency>

+ 9 - 0
hsweb-system/hsweb-system-authorization/hsweb-system-authorization-local/src/main/resources/hsweb-module.json

@@ -0,0 +1,9 @@
+{
+  "groupId": "${project.groupId}",
+  "artifactId": "${project.artifactId}",
+  "path": "hsweb-system/hsweb-system-authorization",
+  "gitCommitHash": "${git.commit.hash}",
+  "gitRepository": "http://github.com/hs-web/hsweb-framework",
+  "version": "${project.version}",
+  "comment": "权限管理"
+}