大家!我一直试图使用Maven Shade插件获取jar,但我仍然没有获得成功:(
这是我的项目结构:
MainModule
-Module1
-src
-pom.xml
-Module2
-src
-pom.xml
-pom.xml
Run Code Online (Sandbox Code Playgroud)
Module1(pom.xml):
<parent>
<artifactId>MainModule</artifactId>
<groupId>com.plugintest</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>Module1</artifactId>
Run Code Online (Sandbox Code Playgroud)
Module2(pom.xml):
<parent>
<artifactId>MainModule</artifactId>
<groupId>com.plugintest</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>Module1</artifactId>
Run Code Online (Sandbox Code Playgroud)
MainModule(pom.xml):
<groupId>com.plugintest</groupId>
<artifactId>MainModule</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<modules>
<module>Module1</module>
<module>Module2</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Run Code Online (Sandbox Code Playgroud)
根据这段代码,我得到2个jar文件(Module1-version.jar和Module2-version.jar).但这不是我想要的.我希望获得1个jar文件(MainModule-version.jar),其中包含另一个(Module1和Module2).
请告诉我,为什么这个Shade插件不起作用?
我有:
<select id="isTitles">
<option value="true">enable</option>
<option value="false">disable</option>
</select>
Run Code Online (Sandbox Code Playgroud)
在我的index.jsp上.我想知道选择了什么:
response.getWriter().write( "User chose: " + request.getAttribute( "isTitles" ) );
Run Code Online (Sandbox Code Playgroud)
但我有"用户选择:null"... =(
我需要关于我的业务逻辑的好的建议!
我有这样的类层次结构:
Parent
- Child1 implements Parent
- Child2 implements Parent
Run Code Online (Sandbox Code Playgroud)
Child1具有自己的方法和字段,Child2具有其自己的方法和字段。
我可以写:
Parent p = new Child1();
( ( Child1 ) p ).getMethodInParent1
p = new Child2();
( ( Chuld2 ) p ).getMethodInParent2
Run Code Online (Sandbox Code Playgroud)
但是Child1和Child2中有很多方法。我的主要目标是仅使用Parent的一个实例-p。我想问你在代码中到处使用动态转换是否是一个好方法?
我已经阅读了有关访问者模式的信息。它可以帮助我避免动态转换吗?