упаковка библиотеки rxtx в банку с плагином maven - PullRequest
1 голос
/ 25 ноября 2011

Мне нужно создать JAR-файл с зависимостями, и мне нужно добавить библиотеку rxtx в качестве зависимости. но когда я создаю флягу, я не могу видеть rxtx в файле фляги. пожалуйста, напишите мне правильный способ сделать это.

это моя соответствующая часть файла pom

....
    <dependency>
        <groupId>org.rxtx</groupId>
        <artifactId>rxtxcomm</artifactId>
        <version>2.0-7pre1</version>
        <scope>run</scope>
    </dependency>
....

....
<plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.2.1</version>
            <configuration>
                <descriptorRefs>
                    <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs>
                <archive>
                    <manifest>
                        <mainClass>uom.elect.smeter.Output</mainClass>
                    </manifest>
                </archive>
            </configuration>
            <executions>
                <execution>
                    <id>make-assembly</id>
                    <!-- this is used for inheritance merges -->
                    <phase>package</phase>
                    <!-- bind to the packaging phase -->
                    <goals>
                        <goal>single</goal>
                    </goals>
                </execution>
            </executions>

        </plugin>
....

1 Ответ

0 голосов
/ 04 мая 2016
        <plugin>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
                <execution>
                    <id>copy</id>
                    <phase>process-resources</phase>
                    <goals>
                        <goal>copy</goal>
                    </goals>
                    <configuration>
                        <artifactItems>
                            <artifactItem>
                                <groupId>org.company.project</groupId>
                                <artifactId>RXTXcommJar</artifactId>
                                <version>1.0.0</version>
                                <type>jar</type>
                                <outputDirectory>
                                    ${project.build.outputDirectory}
                                </outputDirectory>
                                <destFileName>RXTXcomm.jar</destFileName>
                            </artifactItem>
                            <artifactItem>
                                <groupId>org.company.project</groupId>
                                <artifactId>rxtxParalleldll</artifactId>
                                <version>1.0.0</version>
                                <type>dll</type>
                                <outputDirectory>
                                    ${project.build.outputDirectory}/apps/plugin/
                                </outputDirectory>
                                <destFileName>rxtxParallel.dll</destFileName>
                            </artifactItem>
                            <artifactItem>
                                <groupId>org.company.project</groupId>
                                <artifactId>rxtxSerialdll</artifactId>
                                <version>1.0.0</version>
                                <type>dll</type>
                                <outputDirectory>
                                    ${project.build.outputDirectory}/apps/plugin/
                                </outputDirectory>
                                <destFileName>rxtxSerial.dll</destFileName>
                            </artifactItem>                
                        </artifactItems>
                    </configuration>
                </execution>
            </executions>
        </plugin> 
...