首页 \ 问答 \ maven-verify中没有自动检测JPA实体(No autodetection of JPA Entities in maven-verify)

maven-verify中没有自动检测JPA实体(No autodetection of JPA Entities in maven-verify)

如果我将persistence.xml放在src / test / META-INF文件夹中,自动检测实体不能与maven-verify一起使用。 当persistence.xml位于src / main / META-INF文件夹中时它工作。

在两种情况下,在eclipse中运行测试都是可行的。

当persistence.xml位于src / test文件夹中时,是否有办法让自动检测工作以进行maven-verify?

persistence.xml中:

<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">

  <persistence-unit name="Unit" transaction-type="RESOURCE_LOCAL">
    <properties>
      <!-- Scan for annotated classes and Hibernate mapping XML files -->
      <property name="hibernate.archive.autodetection" value="class" />
    </properties>
  </persistence-unit>

</persistence>

If I put the persistence.xml in the src/test/META-INF folder, autodetection the Entities does not work with maven-verify. When the persistence.xml is located in the src/main/META-INF folder it works.

Running the tests in eclipse works in both cases.

Is there a way to get autodetection to work for maven-verify when the persistence.xml is located in the src/test Folder?

persistence.xml:

<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">

  <persistence-unit name="Unit" transaction-type="RESOURCE_LOCAL">
    <properties>
      <!-- Scan for annotated classes and Hibernate mapping XML files -->
      <property name="hibernate.archive.autodetection" value="class" />
    </properties>
  </persistence-unit>

</persistence>

原文:https://stackoverflow.com/questions/4885836
更新时间:2022-03-18 09:03

最满意答案

我找到了这个答案 ,告诉如何找到具有特定CSS属性的元素(使用jQuery):

var x = $('.myselector').filter(function () { 
    return this.style.position == 'fixed' 
});

如果我们然后使用该返回的集合,我们可以将位置重置为静态:

var x = $('*').filter(function () { 
    return this.style.position == 'fixed' 
}).css('position', 'static');

只需将它放在一个用户脚本中(包含jQuery),你就全都设置好了!


和一个非jQuery解决方案...

var x = document.querySelectorAll('*'); // get all elements
for (var i = 0; i< x.length; i++) {
    if (x[i].style.position == 'fixed') {
        x[i].style.position = 'static';
    }
}

This is great:

https://alisdair.mcdiarmid.org/kill-sticky-headers/

A sticky header is a sure sign of stuff you don't want on your screen, and this just destroys them!

Could probably modify it to change them from fixed to static, but I haven't found a case where I actually want to.

相关问答

更多
  • “你至少需要一个元素” - 这是不正确的。 这里有一个例子: http : //mathiasbynens.be/demo/safari-reader-test-3 我对另一个Safari阅读器问题的回答提供了一些更多信息。 您还可以阅读我的博客文章,了解关于此主题的所有发现。 “You need at least one element” — this is simply incorrect. Here’s an example: http://mathiasbynens.be/demo ...
  • 我找到了这个答案 ,告诉如何找到具有特定CSS属性的元素(使用jQuery): var x = $('.myselector').filter(function () { return this.style.position == 'fixed' }); 如果我们然后使用该返回的集合,我们可以将位置重置为静态: var x = $('*').filter(function () { return this.style.position == 'fixed' }).css('posi ...
  • 您可以通过为“contextmenu”事件添加事件侦听器并调用preventDefault()方法来实现JavaScript: document.addEventListener('contextmenu', event => event.preventDefault()); 这就是说: 不要这样做。 为什么? 因为除了烦人的用户之外, 许多浏览器也有安全选项,禁止禁止右键单击(上下文)菜单。 不知道为什么你会想。 如果这种错误的置信可以保护您的源代码或图像,请再考虑一下:你不能。 You can do ...
  • 其中一种方法,可能是在页面中递归迭代所有控件并禁用标签控件的视图状态 - 显而易见的问题是你需要在页面循环的早期执行此操作然后在这种情况下,您可能会错过动态添加控件。 更优雅的解决方案是创建一个继承自标签控件的自定义控件并禁用视图状态(例如在构造函数中) - 例如 public class MyLabel : System.Web.UI.WebControls { Public MyLabel() { EnableViewState = false; } } (请注意,在强大的实 ...
  • 它是配置在该特定Web服务器上的任何东西。 可以将Web服务器配置为使用带有perl的php模块和.aspx文件运行.pl文件,尽管这将是愚蠢的。 大多数Web服务器都没有涉及到脚本,而是必须查看apache配置文件(或者如果使用不同的服务器软件)。 如果您有权限编辑服务器配置文件,那么您可以使以.do结尾的文件以php的形式运行,如果这是您以后的。 It is whatever it is configured to be on that particular web server. A web serv ...
  • 强制执行draggable()对象到固定位置。 尝试向固定元素添加高z-index。 position: fixed; z-index: 1000; 要么 position: fixed !important; To enforced draggable() object to fixed position. Try to add a high z-index to the fixed element. position: fixed; z-index: 1000; Or position: fixe ...
  • 将你的移动到一个自定义控件例如MyScriptManager.ascx - .ascx文件中的唯一代码将是ScriptManager标记 - 然后你可以在你的自定义控件上设置Visible属性来控制ScriptManager是否被渲染。 您甚至可以将一个Property添加到您的MasterPage中,您可以在您的内容 ...
  • 第一点是你不需要滚动来获取硒的全屏幕截图。 删除重复数据的方法: 采取完整的窗口屏幕截图,不要将其保存到任何文件。 观察重复数据(Header对象) 使用ImageIO.read()方法为屏幕截图文件创建bufferedImage对象。 使用.getLocation().getX()/getY()方法获取重复部分(标题)的x&y坐标。 从整个屏幕截图中使用.getSubimage()方法删除重复数据。 然后使用ImageIO.write()方法将图像保存到任何文件。 Remove Sticky Data W ...
  • 您可以使用Maven WAR插件从构建中排除资源。 您可以使用通配符和偶数表达式来指定要排除的内容。 让我们参考文档中的一些改编示例: maven-war-plugin 2.4 *-test.xhtml
  • 除非页面提供链接(例如,维基百科对大多数文章都这样做: 例如,标题为“内容” ): 用户必须检查HTML并查找id属性,或者查找具有name属性的a / area元素(必须在应该链接到的元素附近)。 用户必须将此属性的值附加到当前URL,前缀为# (或者如果已经存在这样的片段则替换它)。 (可能有浏览器扩展可以更容易地找到这些属性,甚至生成链接。您可以在Software Recommendations SE上询问它们。) 如果相关元素没有这样的属性,则无法链接到它,除非我们讨论在用户端安装的其他软件(例如, ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)