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

yan-service如何打jar包,一直报错 #4

Open
duanyanjie opened this issue Apr 26, 2018 · 6 comments
Open

yan-service如何打jar包,一直报错 #4

duanyanjie opened this issue Apr 26, 2018 · 6 comments

Comments

@duanyanjie
Copy link

yan-service如何打jar包,一直报错

@micyo202
Copy link
Owner

micyo202 commented May 2, 2018

使用maven进行打包

首先在yan工程下下执行install,将项目依赖安装到本地maven仓库

其次执行package进行打包

打包完成后控制台输出如下信息:

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] yan ................................................ SUCCESS [  0.004 s]
[INFO] yan-common ......................................... SUCCESS [  4.521 s]
[INFO] yan-plugins ........................................ SUCCESS [  0.283 s]
[INFO] yan-dao ............................................ SUCCESS [  1.485 s]
[INFO] yan-api ............................................ SUCCESS [  0.462 s]
[INFO] yan-core ........................................... SUCCESS [  0.795 s]
[INFO] yan-service ........................................ SUCCESS [  0.478 s]
[INFO] yan-web ............................................ SUCCESS [  7.077 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

@duanyanjie
Copy link
Author

您好,按照您的方法先install,然后package,在yan-service/target中生成yan-service-1.0-SNAPSHOT.jar
使用java -jar 运行,报没有主清单属性。
随后,我在Project Structure中Artifacts新增JAR->From modules with depenencies,并配置了主函数,如此打包后的jar,可以使用java -jar 执行成功,没有任何报错,但是就是zookeeper没有任何注册信息,即注册失败。
所以我想请教一下,如果使用java -jar 运行,且能正常注册zookeeper,这个yan-service应如何打包?多谢!

@Apollo-Pro
Copy link

问题解决了吗?我打出来的jar包执行完报错了
image

@Apollo-Pro
Copy link

image
问题解决了,这里配置的是通配符导致找不到这个包,这应该跟我打jar的方式有关,你们是怎么打的

@micyo202
Copy link
Owner

micyo202 commented Oct 30, 2018 via email

@Apollo-Pro
Copy link

感谢百忙之中抽空解答! 我看是有这个代码的,是扫描的时候,这个匹配的会每个包去扫描,扫到第一个包的时候没有找到这个 mapper 。后面指定到 com.yan.dao.mapper 打出来的包就一切正常运行了。但是这里有点疑惑的是用idea直接运行的时候就不会有这个问题,其中具体的问题我这边继续研究一下,下面贴一下我的yan-server pom.xml的配置

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>1.4</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <filters>
                                <filter>
                                    <artifact>*:*</artifact>
                                    <excludes>
                                        <exclude>META-INF/*.SF</exclude>
                                        <exclude>META-INF/*.DSA</exclude>
                                        <exclude>META-INF/*.RSA</exclude>
                                    </excludes>
                                </filter>
                            </filters>
                            <transformers>
                                <transformer
                                        implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <mainClass>com.yan.service.ServiceApp</mainClass>
                                </transformer>
                                <transformer
                                        implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                    <resource>META-INF/spring.handlers</resource>
                                </transformer>
                                <transformer
                                        implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                                    <resource>META-INF/spring.schemas</resource>
                                </transformer>
                            </transformers>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>

    </build>

同时希望知道其中问题的能分享一下

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