gpt4 book ai didi

java - maven添加的war依赖没有解决?

转载 作者:行者123 更新时间:2023-12-02 03:07:34 26 4
gpt4 key购买 nike

我几天前开始使用maven,我试图使用jquery日历工具,所以当我尝试添加依赖项时,maven放置了一个WAR依赖项,我很好奇我打开了它,它确实包含必要的导入类。但我的 IDE 告诉我导入未解决!我不明白发生了什么,我搜索知道什么是 war ,我发现那是Web Java应用程序。难道不能把 war 当作图书馆吗?这就是我的导入不起作用的原因吗?

在我的pom下面,设置xml文件并在java代码中导入

pom.xml

    <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>gestion_stock</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

<repositories>
<repository>
<id>sonatype-snapshots</id>
<name>Sonatype Snapshots Repository</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>com.googlecode.wicket-jquery-ui</groupId>
<artifactId>wicket-jquery-ui</artifactId>
<version>8.0.0-M3</version>
</dependency>
<dependency>
<groupId>com.googlecode.wicket-jquery-ui</groupId>
<artifactId>jquery-ui-calendar</artifactId>
<version>6.2.2</version>
</dependency>
<dependency>
<groupId>com.googlecode.wicket-jquery-ui</groupId>
<artifactId>jquery-ui-core</artifactId>
<version>6.2.2</version>
</dependency>
<dependency>
<groupId>org.wicketstuff</groupId>
<artifactId>wicketstuff-bundle</artifactId>
<version>8.0.0-SNAPSHOT</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.googlecode.wicket-jquery-ui</groupId>
<artifactId>wicket-jquery-ui-calendar</artifactId>
<version>8.0.0-SNAPSHOT</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.googlecode.wicket-jquery-ui</groupId>
<artifactId>wicket-jquery-ui-samples</artifactId>
<version>8.0.0-SNAPSHOT</version>
<type>war</type>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
</project>

设置.xml

    <?xml version="1.0" encoding="UTF-8"?>
<!--
User-specific configuration for maven. Includes things that should not
be distributed with the pom.xml file, such as developer identity, along with
local settings, like proxy information. The default location for the
settings file is ~/.m2/settings.xml
-->
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<!--proxies>
<proxy>
<host>my.proxy.host</host>
</proxy>
</proxies-->

<!--pluginGroups>
<pluginGroup>org.codehaus.mojo</pluginGroup>
</pluginGroups-->
</settings>

扩展日历页面.java

    package com.talcorp.gestion_stock;

import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.Date;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.panel.FeedbackPanel;

import com.googlecode.wicket.jquery.core.Options;
import com.googlecode.wicket.jquery.ui.calendar.Calendar;
import com.googlecode.wicket.jquery.ui.calendar.CalendarView;
import com.googlecode.wicket.jquery.ui.panel.JQueryFeedbackPanel;
// the non working imports in the wicket-jquery-ui-samples-8.0.0-SNAPSHOOT.war
import com.googlecode.wicket.jquery.ui.samples.component.DemoCalendarDialog;
import com.googlecode.wicket.jquery.ui.samples.data.DemoCalendarEvent;
import com.googlecode.wicket.jquery.ui.samples.data.DemoCalendarModel;
import com.googlecode.wicket.jquery.ui.samples.data.dao.CalendarDAO;

public class ExtendedCalendarPage extends AbstractCalendarPage
{
private static final long serialVersionUID = 1L;

private Calendar calendar;

.

.

.

}

注意: war 存储在项目中名为:Non-classpath-dependencies 的文件中

谢谢

最佳答案

Maven 有一个适用于这种情况的插件,它应该存在于 war 应用程序/库中 - 它创建了一个类 Artifact 。

<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<attachClasses>true</attachClasses>
</configuration>
</plugin>

这个,你可以在你的项目中使用下面的引用

<dependency>
<groupId>your-group-id</groupId>
<artifactId>your-artifact-id</artifactId>
<version>your-version</version>
<classifier>classes</classifier>
</dependency>

关于java - maven添加的war依赖没有解决?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41552014/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com