簡體   English   中英

Maven構建依賴項jar文件未反映代碼更改

[英]maven build dependency jar file not reflecting changes in code

我正在嘗試使用目標mvn軟件包構建一個Maven項目。當我構建項目時,生成了兩個jar文件,一個是demo-lwm2m-client-1.0-jar-with-dependencies.jar,另一個是demo-lwm2m-client-1.0。現在,如果我對放置在src / main / resources中的文件進行了一些更改並再次構建了項目,我發現demo-lwm2m-client-1.0-jar-with-dependencies.jar無法反映所做的更改在demo-lwm2m-client-1.0.jar反映代碼更改的同時做了代碼。如何在依賴項jar中反映我的代碼更改。以下是我的pom.xml的代碼。 http://maven.apache.org/xsd/maven-4.0.0.xsd“> 4.0.0

<groupId>com.demo.lwm2m.client</groupId>
<artifactId>demo-lwm2m-client</artifactId>
<packaging>jar</packaging>
<version>1.0</version>

<name>DemoLwm2mClient</name>
<url>http://maven.apache.org</url>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
    <dependency>
        <groupId>org.eclipse.leshan</groupId>
        <artifactId>leshan-client-cf</artifactId>
        <version>1.0.0-M1</version>
    </dependency>


    <dependency>
        <groupId>com.appiot.examples</groupId>
        <artifactId>simulatedplatform</artifactId>
        <version>1.0</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.7.5</version>
    </dependency>

    <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>2.4</version>
    </dependency>       
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>1.7.5</version>
    </dependency>
</dependencies>
<repositories>

    <repository>
        <id>eclipse</id>
        <url>https://repo.eclipse.org/content/repositories/leshan-snapshots</url>
        <releases>
            <enabled>false</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>       
</repositories>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.4</version>
            <configuration>
                <archive>
                    <manifest>
                        <mainClass>com.demo.lwm2m.MainClass</mainClass>
                    </manifest>
                </archive>
                <descriptorRefs>
                    <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs>
            </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>
    </plugins>

</build>

使用mvn clean install 這將重建所有內容,並且包括所有更改。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM