Гость
Целевая тема:
Создать новую тему:
Автор:
Форумы / Java [игнор отключен] [закрыт для гостей] / Сборка maven-проекта / 6 сообщений из 6, страница 1 из 1
23.11.2012, 18:35:51
    #38051165
Сборка maven-проекта
Как запаковать отдельно стоящий jar в основной jar при сборке maven-проекта?
...
Рейтинг: 0 / 0
23.11.2012, 19:05:29
    #38051193
Denis Popov
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Сборка maven-проекта
On 23.11.2012 19:35, Степовой А. С. wrote:

> Как запаковать отдельно стоящий jar в основной jar при сборке maven-проекта?

Посмотри на Maven Assembly plugin: http://maven.apache.org/plugins/maven-assembly-plugin/

Posted via ActualForum NNTP Server 1.5
...
Рейтинг: 0 / 0
23.11.2012, 20:02:18
    #38051260
dmitriyche
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Сборка maven-проекта
Степовой А. С.,

Посмотрите в сторону Apache Shade plugin .
Вот пример использования
И ещё один пример - там Java Mail API и MySQL Connector запаковывается в целевой jar.
...
Рейтинг: 0 / 0
24.11.2012, 00:35:48
    #38051430
marx_freedom
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Сборка maven-проекта
...
Рейтинг: 0 / 0
24.11.2012, 12:19:03
    #38051572
dominator
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Сборка maven-проекта
...
Рейтинг: 0 / 0
24.11.2012, 13:15:10
    #38051594
oson
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Сборка maven-проекта
Код: xml
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
<build>
        <plugins>
            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>jarjar-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>jarjar</goal>
                        </goals>
                        <configuration>
                            <includes>
                                <include>com.sun.media:jai_imageio</include>
                                <include>com.sun.media:jai-codec</include>
                            </includes>
                            <rules>
                                <rule>
                                    <pattern>com.sun.media.**</pattern>
                                    <result>my.cool.app.@1<;/result>
                                </rule>
                                <keep>
                                    <pattern>my.cool.app.**</pattern>
                                </keep>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>



Примерно вот так.
По поводу

Код: xml
1.
2.
<pattern>com.sun.media.**</pattern>
<result>my.cool.app.@1<;/result>



то заменит имена пакетов вначале - то есть если был например com.sun.media.jai.Class1, то получится my.cool.app.jai.Class1.

Насчет

Код: xml
1.
2.
3.
<keep>
<pattern>my.cool.app.**</pattern>
</keep>


надо уточнить. Можно посмотреть тут

http://code.google.com/p/jarjar/wiki/CommandLineDocs

jarjar wikiThe rules file is a text file, one rule per line. Leading and trailing whitespace is ignored. There are three types of rules:

rule <pattern> <result>
zap <pattern>
keep <pattern>
The standard rule (rule) is used to rename classes. All references to the renamed classes will also be updated. If a class name is matched by more than one rule, only the first one will apply.

<pattern> is a class name with optional wildcards. ** will match against any valid class name substring. To match a single package component (by excluding . from the match), a single * may be used instead.

<result> is a class name which can optionally reference the substrings matched by the wildcards. A numbered reference is available for every * or ** in the <pattern>, starting from left to right: @1, @2, etc. A special @0 reference contains the entire matched class name.

The zap rule causes any matched class to be removed from the resulting jar file. All zap rules are processed before renaming rules.

The keep rule marks all matched classes as "roots". If any keep rules are defined all classes which are not reachable from the roots via dependency analysis are discarded when writing the output jar. This is the last step in the process, after renaming and zapping.
...
Рейтинг: 0 / 0
Форумы / Java [игнор отключен] [закрыт для гостей] / Сборка maven-проекта / 6 сообщений из 6, страница 1 из 1
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]